The function isn’t working when i’m using $(document).ready(function () { ..... });
but it works when i invoke. please take a look.
#test {height:25%,width:25% }
<body>
....
<div id="test">
<image src="file.jpg" />
</div>
...
</div> </body>
js file (Not working) :
$(document).ready(function () {
$('#test').draggable();
});
js file (Working when a function is invoked)
function startDrag() { // I just called this function from html files e.g. <div id="test" onmouseover="startDrag();">....</div>
$('#test').draggable();
}
I wonder if this is something that relies on the document being ‘loaded’ as opposed to ‘ready’
Does the following work?
Also, try including your JS File at the foot of your page (i.e. below the #test html)