jQuery UI draggable is not a function Error up vote 0 down vote favorite Ok, I keep getting an error message and am unable to drag any of the divs

if(!jQuery.ui)
{
   // bla bla
}

Is causing error, since the jQuery is not defined. I think that you should wait for the jQuery to be fully loaded first then continue to the next function to check availability of jQuery UI. You need to use Synhronous execution of your script:

if(!window.jQuery)
{
   var script = document.createElement("script");
   script.type = "text/javascript";
   script.async = false; // CHANGES
   script.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
   var oScripts = document.getElementsByTagName("script");
   var s = oScripts[0];
   s.parentNode.insertBefore(script, s);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: