I\'ve trying to use the draggable effect on some divs on a page, but whenever I load the page, I get the error message:
Error: $(\".draggable\").draggable is
The cause to this error is usually because you're probably using a bootstrap framework and have already included a jquery file somewhere else may at the head or right above the closing body tag, in that case all you need to do is to include the jquery ui file wherever you have the jquery file or on both both places and you'll be fine...
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
just include the above jquery ui script wherever you are importing the jquery file along with other bootstrap dependencies.
You can import these js Files. It worked fine for me.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" ></script>
This may be helpful for some one :
In my case i was able to remove this error by first loading the js files on which draggable depends. They were ui.mouse.js, ui.core and ui.widget i.e UI Core Widget Factory Mouse Interaction
Make sure the script tag for loading dependencies lies above the draggable js loading tag.
This issue can also be caused if you include the normal jquery library twice. I had the following line twice, in my body and head.
It never caused any problems until I tried to use jquery UI as well.
I had this junk at the bottom of my _layout mvc page that I found via chromes debugger (network section) loading jquery 1.10.2 after the jquery / jqueryui sections at the top of the same file. When I removed all that .sortable and .draggable started working.
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)