Why doesn't fire event fire after mouseDown event on the same element?
I have a mouseDown event and a click event on one element. When I click on it, the mouseDown event fires (ie, the "Mouse Pressed on P" warnings), but there is no click event. However, if I comment out the mouseDown alert statement, the click event will show its alert. Why is this? http://jsfiddle.net/A8vhq/
+3
source to share
3 answers
alert
Use instead console.log
and it will work.
Live demo: http://jsfiddle.net/A8vhq/1/
Btw, I changed the code a bit:
$('p').on('mousedown', function (e) {
console.log('Mouse pressed on ' + e.target.nodeName);
});
$('p').on('click', function (e) {
console.log(e.target.nodeName + ' clicked');
});
0
source to share