Prevent table row onclick event to fire when clicking button inside the row

前端 未结 4 635
后悔当初
后悔当初 2021-02-01 17:01

I have a table row with ONCLICK event (that toggles additional data below). Inside one of the row cells I have a button (when clicked is performing an AJAX action). When I click

4条回答
  •  心在旅途
    2021-02-01 17:12

    If you dislike the javascript solution, in many cases a CSS solution is possible as well:

    style="pointer-events: none;"
    

    That will supress the onclick event.

    However, in some cases I still had issues where it didn't seem to work. In the majority of cases I just use the style above.

提交回复
热议问题