javascript - JQuery event.stopPropagation() not working -


In my HTML, I have a class drag handle gap which is embedded inside a li.

  & lt; Div class = 'treeView' & gt; & Lt; Ul class = 'tree' & gt; & Lt; Li & gt; & Lt; Span class = "dragHandle" & gt; & Lt; / Span & gt; Item 1 & lt; Ul & gt; & Lt; Li & gt; & Lt; Span class = "draghandle" & gt; & Lt; / Span & gt; Item 2 & lt; A href = "#" & gt; Link & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

I add event handlers using jQuery as follows:

  $ (". Tree tree"). Click (function (event) {alert ("click"); Event.stopPropagation ();}); $ ("Dragheadhandle"). Mosudown (event) {warning ("down"); event.stopPropagation ();}); $ ("DragHandle"). Mousewipe (function) {warning ("up"); event.stopPropagation ();});  

When I move the mouse and mouse over the element, I get further alerts, although I get a click alert of Lee's event handler. I thought this call should be stopped from the event. In the stupprogication, in the Musudown and mouseup operators How do I stop click events called for mousedown / up events on dragheads?

TIA, Adam

I'm going to have the mouse / How to stop click event called?

Capture you ... and eat ... that event:

  $ ("DragHandle"). Click (function (event) {event.stopPropagation ();}); The key here is that  click ,  mozudown , and  mouseup  are different events, even though you < Code> click  as a  Mousewaidown  as  mouseup , you can actually have  click  Events arising from user actions that do not include the mouse, as well as the combination of  mousedown  and  mouseup , which is not the result of  by clicking Not  Events found. 


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -