views:

367

answers:

3

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?

A: 

Got any errors in Firebug?

Hank Gay
+8  A: 

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

yoda
That's it. I was able to get it to run when I switched those.
Rich Reuter
I cant believe that actually worked :|Thanks for that, twas frustrating
Sam Gregory
jQuery UI is a jQuery plugin, just like every other jQuery plugin it needs jQuery to be loaded before it.
PetersenDidIt
+2  A: 

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>
BenTheDesigner
Yoda beat me to it, +1.
BenTheDesigner