Sam Gregory
Sam Gregory

Reputation: 139

JQuery UI draggable not working at all!

Why does this not work at all for me?

<script type="text/javascript" src="Javascript/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="Javascript/jquery-1.3.2.min.js"></script>     
<script type="text/javascript">

    $(function() {
    $('.selector').draggable({ axis: 'x' });    });

    </script>

    <body>

    <div class="selector">
        <p>Drag me around</p>
    </div>

I have literally just copied and pasted from the draggable example page on the jQuery site and it just doesn't work :(

Can anyone tell me why?

Upvotes: 3

Views: 6507

Answers (2)

BenTheDesigner
BenTheDesigner

Reputation: 1984

May sound trivial but you need to load the jQuery library before jQuery UI:

<script type="text/javascript" src="Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="Javascript/jquery-ui-1.7.2.custom.min.js"></script>     
<script type="text/javascript">
  $(function() {
    $('.selector').draggable({ axis: 'x' });
  });
</script>
<body>
  <div class="selector">
    <p>Drag me around</p>
  </div>

Upvotes: 5

yoda
yoda

Reputation: 10981

Change the order of the javascript includes, the jQuery core file always comes first.

Upvotes: 15

Related Questions