javascript - How to use event.stopPropagation() in delegate() -


my code following in html:

<li class="arrow">         <div>         <a href="javascript:void(0);" class="anchor">remove</a>      </div>                       </li> 

and bind elements using deligate() jquery method (because elements appear dynamically)

$obj.delegate(".arrow", "click", function() {     alert("clicked on arrow"); });  $obj.delegate(".anchor", "click", function(event) {      event.stoppropagation();      alert("anchor clicked"); }); 

my problem is, when click on ".anchor" both events occurs. can tell me how use event.stoppropagation() in context? tried above not working. there other way this?

edit: tried calling event.ispropagationstopped(), , returns true. still both events called.

there limitations when delegate or live used , stoppropagation.

you return false in handler prevent both eventpropagation , default

try

$obj.delegate(".anchor", "click", function(event) {      alert("anchor clicked");      return false; }); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -