I’m very new to JQuery and I’m trying to create a sample page using the Draggable plugin. The page loads fine, but I’m not able to drag my <div> tag anywhere. I’ve been trying to copy this demo. Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<style type="text/css">
#draggable { width: 150px; height: 150px; padding: 0.5em; border: solid 1px black; cursor:pointer;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<script src="scripts/jquery.js" type="text/javascript"/>
<script src="scripts/jquery.ui.core.js" type="text/javascript"/>
<script src="scripts/jquery.ui.draggable.js" type="text/javascript"/>
<script src="scripts/jquery.ui.mouse.js" type="text/javascript"/>
<script src="scripts/jquery.ui.widget.js" type="text/javascript"/>
<script src="scripts/jquery-ui-1.8.13.custom.js" type="text/javascript" />
<script type="text/javascript">
$(document).ready(function() {
$("#draggable").draggable();
});
</script>
<div class="demo" style="height: 500px; width: 500px;">
<div id="draggable">
<p>Drag me around</p>
</div>
</div>
</div>
</form>
</body>
</html>
I’m just trying to make it so I can drag my “draggable” <div> around in the “demo” <div> around it. Can anyone see what I’m missing?
Have you included the jQuery UI script on your page? Here is CDN link to the latest versions.
I use the Html5Boilerplate best practice of: