views:

396

answers:

1

Hi,

i wan to disable drag event using jquery and want to bind one another event with same mouse event, but it will shows an error

i have attached drag even to

<div class="mydiv"></div>

and i have used

jQuery('.mydiv').draggable("destroy");

it is disabling the drag event and attached one more functionality on mouse down

but when i will press mouse on div and dragging the cursor then it shows error

$(this).data("draggable") is undefined
[Break on this error] var t = $('body'), o = $(this).data('draggable').options; 

and this is in ui.draggable.js,

any buddy have any idea about this??

A: 

The problem might be that you have initialized draggable on a collection of elements, and destroying it on the single element causes some weirdness. What you might try doing is removing the ui-draggable class from that particular element:

jQuery('.mydiv').removeClass("ui-draggable");

Of course, that might not change a thing.

karim79
i have already tried for the same but it wasn't working
Chirag
i have also disable dragging on all dom elements..but it was not working
Chirag