Skip to content

Instantly share code, notes, and snippets.

@cryocaustik
Created October 1, 2020 01:42
Show Gist options
  • Save cryocaustik/595eb87f4b64abee025317d68b1005df to your computer and use it in GitHub Desktop.
Save cryocaustik/595eb87f4b64abee025317d68b1005df to your computer and use it in GitHub Desktop.
force data tables onto html table in any site
// inject jquery
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// inject data tables
var dt = document.createElement('script');
dt.src = "//cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js";
document.getElementsByTagName('head')[0].appendChild(dt);
var dtcss = document.createElement('link');
dtcss.src = "//cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css";
document.getElementsByTagName('head')[0].appendChild(dtcss);
// initiate data table
$('.domain-record-table').DataTable();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment