javascript - Click Button not click through to Table Row -
i have table i've implemented accordion effect. 1 of cells has <button>
. if click button, button's onclick happens, table row takes click (which expands/collapses accordion). how prevent click going through button table row?
this click function:
$("#accordiontable tr.accordion-parent").click(function () { $(this).nextuntil(".accordion-parent").toggle(); $(this).find(".accordion-arrow").toggleclass("ui-icon-circle-triangle-e"); $(this).find(".accordion-arrow").toggleclass("ui-icon-circle-triangle-s"); });
and 1 of cells has <button onclick="docommand()">
in it.
call jquery's event.stoppropagation() function.
https://api.jquery.com/event.stoppropagation/
$("#accordiontable tr.accordion-parent").click(function (e) { e.stoppropagation(); $(this).nextuntil(".accordion-parent").toggle(); $(this).find(".accordion-arrow").toggleclass("ui-icon-circle-triangle-e"); $(this).find(".accordion-arrow").toggleclass("ui-icon-circle-triangle-s"); });
Comments
Post a Comment