user500665 user500665 - 1 year ago 111
jQuery Question

How to load inline script after JQuery and JQuery UI?

I have several inline tags that appear in the middle of my HTML document. These all require Jquery, and a couple need JQuery UI.

JQuery and JQuery UI are linked at the bottom of the document.

How can I have the inline scripts run after JQuery and UI are ready.

I have tried wrapping the inline scripts with this with no success:

$(window).load(function() {

And I have also tried darbio's answer here using:

function defer(method) {
if (window.jQuery)
setTimeout(function() { defer(method) }, 50);
defer(function () {
alert("jQuery is now loaded");

But this didn't seem to work either?

Answer Source

you should load jQuery and jquery-ui in your header if you want to run jQuery inside the DOM,

alternatively you could add window.onload() to all your script to prevent running it before the DOM is ready

src: onload

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download