King Kong
King Kong

Reputation: 2915

Want to drag a div through jquery

I am trying to use the jquery UI draggable option handle, but not working, i tried :

      $("div").draggable( { handle : $("#buttonid") })

Can anyody tell me the problem?

Edit

The handle is not actually working as a handle, means i want to drag handle to drag div, but it is not working ?

Upvotes: 1

Views: 651

Answers (1)

thecodeparadox
thecodeparadox

Reputation: 87083

$("div").draggable( { 
         handle : "#buttonid"  // you need not to wrap with $()
       });

According to your edit

I haven't tested this. As Button's default event-handler for mousedown. You might want to try with event.preventDefault() inside a mousedown handler or alternatively wrap that button with a span or div and make that div or span as handler, But I think none of them will work.

For more look here

Upvotes: 3

Related Questions