I know that this may seem a weird thing to do, but I want to stop the click event from being executed and I want to do it from the mouseup.
Here's my testing code:
var $a = $('#link');
$a.mouseup(function(e){
alert('mouseUp');
e.stopPropagation();
e.preventDefault();
return false;
});
$a.click(function(e){
alert('click');
});
(or jsFiddle version: http://jsfiddle.net/U3EWt/1/)
I'm doing it in my example on a regular browser with mouse events, but my ultimate goal is to achieve the same result with touch devices with touchend event instead of mouseup.
As you can see, I tried with stopPropagation(), preventDefault() and return false in the hope that the click wouldn't be triggered. But it's not working... Is there any way that I can block the event to continue to click() after the mouseup?
Thanks!
click
handler if you don't need it.<div>
instead of<a>
(smth that's not clickable) and attach aclick
event yourself for the browsers. If it happens to be a mobile device - no event listener attached.