I have a jQuery DataTables (latest download) where I am trying to display a loading animation beside the pagination controls on the bottom. It should be easy and part of the following code works:
$("#table_main_paginate").css("width", "50%");
$("#table_main_paginate").prepend($("<div> jjjj </div>"));
above code is after the DataTable has already initialized and the CSS
for width
indeed does work. But the second line of code does not work. My javascript file is loaded after other javascript files are loaded and the above code is inside the documentReady
function.
So what's happening?
Thanks!
Try this:
setTimeout(function(){
$("#table_main_paginate").css("width", "50%");
$("#table_main_paginate").prepend($("<div> jjjj </div>"));
},2000);
However, sometimes jquery plugins takes some time to initialize completely