I use datatables and yadcf to filter results. I actually set it up on Drupal 8, but then I created a simple HTML site so I can post it and get help. The datatable and yadcf filters are working properly. However, when I go to a page on my site that does not contain a table with the class name of my datatable init and my variable oTable, I get TypeError: oTable is undefined. I have a Drupal site with many pages. We allow editors to copy data to the ckeditor. A data table can therefore be on every page. I'm told I need to load datatables.js and jquery.dataTables.yadcf.js only on pages that contain a datable. Removing the yadcf.init section of my code will fix the bug. I think my syntax is wrong? I want to have over 40 different datatables configurations. So I'll have var oTable1, oTable2, oTable3, and so on; Example here A page containing a datatable and no errors. Example here A page that has no data table has the error. Look at the console log and you will see the error.