$(document).ready(function() {} or not?
$(document).ready(function() {} or not?
stephanb
Posts: 36Questions: 11Answers: 0
I see some examples that depend on datatables being initialized from inside the ready() method, but I don't see that in the documentation for datatables. Is there a special case when it should be nested as part of ready()?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm not sure what you mean by nested.
Basically you want to initialize Datatables after the
table
element is written to the document. Generally a good place for that is in$(document).ready(function()
. There are times you will want to initialize after some event like thesuccess
function of a jQuery ajax() request. There are no rules or requirements except a -tag table` being available as per the HTML docs.Kevin