I have
$('#myElem').mouseup(function(e){
isMouseDown = false;
});
What I want to do is trigger a single event (e.g. an alert, or ++1 to a counter) only on the first of what might be a number of mousedown events.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have multiple bindings and are filtering, you can use
event.stopPropagationwithin the event and stop it from going up the event list. Though it’s still not clear what you mean about “first of what might be a number of mousedown events”. (Bound to multiple selectors relating to same element, bound to children within a parent, …)You can also use
.one()and bind to an event only after a previous event has occurred. Likewise, you can add/remove binding based on specific events.