javascript - Stop Event bubbling for a disabled element -
i have button has style
pointer-events: none;
and button has parent element performs collapsible event. don't know how prevent button triggering parent elements collapsible event. caused because of button style pointer-events: none
thanks
assuming following html:
<div class="collapsible"> <button>hi</button> </div>
you this:
$('.collapsible').click(function(e) { if ($(this).children('button').css('pointer-events') == 'none') return; //do collapse });
or maybe this:
$('.collapsible').click(function(e) { //do collapse }); $('.collapsible button').click(function(e) { if ($(this).css('pointer-events') == 'none') e.stoppropagation(); });
Comments
Post a Comment