I have several jQuery event listener on several links in a matrix (it’s a map parcel selection).
Now i already prevent the default action on mousedown, but if i prevent the action on mouseup, it doesn’t work.
I prevent the default action on mousedown on a link and start “marking” elements from there on. If a “mouseup” occurs in the same Element, the link get’s executed.
So what i need to do is prevent link execution in mouseup, but it doesn’t work.
$('a.parcel').on('mouseup',function(event){
event.preventDefault();
});
This still executes the link that is given in the href of the a element.
Any Ideas anyone?
The default action you are preventing on the
mouseupevent is not responsible for changing the href. That being said, it doesn’t matter if you prevent it or not, the href gets executed on theclickevent.The
clickevent gets fired aftermousedown, so changing themouseuptoclickshould work just fine.