I allow move (drag & drop) some elements that contain an internal link ( a), after the user canceled it, it redirects the browser to the hrefmoved element. How can I let this item click and drag and drop it? I am using the http://dragsort.codeplex.com/ plugin.
a
href
You would prevent the default behavior on links, buttons, etc. using preventDefault();
preventDefault()
$( ".selector" ).draggable({ stop: function(event, ui) { // Do some stuff when you've finished dragging your element event.preventDefault(); } });
Learn more about the jQuery API .
event.preventDefault(), , . , , , -vs- . , , :
$('.something').click(function(event) { if ($(this).data('dragging')) { event.preventDefault(); $(this).data('dragging',false); } }