Is it possible to call jQuery's $(document).ready
function from within another Javascript function? I have a button, which when clicked should call the jQuery DOM ready function. Is this possible?
Javascript – Calling jQuery’s DOM ready function from another function
javascriptjquery
Best Answer
If you are calling it from another javascript function, drop the
$(document).ready
partor if you want to call a function only when the document is ready, put the function call inside
$(document).ready
But you are not taking advantage of jquery's full functionality here. If you want to associate an onclick event with an element, you can do it like so:
In the js file: