dom - How to prevent the event handler in a nested element within the target element in jQuery? -
<tr> <td> <a></a> </td> </tr>
ok thing <tr> node have event listener $('tr').click(handler1). don't want <a> node have same behaviour has.
is there anyway can without jquery?
add event handler , prevent default
$(function(){ $("tr a").click(function(e){ e.preventdefault(); }); }); update: batter yet if want link go on doing default action don't want event bubble tr alter e.stoppropagation(); instead of e.preventdefault();
jquery dom javascript-events
No comments:
Post a Comment