That’s usually accomplished by calling stopPropagation on the click event of the button, which prevents the event from bubbling.
See example below: you’ll notice that when you click the button, you only see the console log of “button clicked”, and not “row clicked.” This is because the stopPropagation prevented the click event for the tr from firing.
*Edit: @skapicic’s solution of using a data attribute is IMHO a better way of doing it, but if you really want to use an inline event handler, you can do a stopPropagation like this:
In the table row I have click event like onclick="trDetailsModal(this, 'id')" and I am showing details in the modal. So inside the tr I have also two buttons under actions td, those buttons are also having onclick event like onclick="deleteRecord('id')";
I am able to see details in a modal by clicking on tr.
Now the problem is when I click one of the buttons the tr onclick also getting triggered and showing details also in model.
So how to stop tr onclick while clicking one of those buttons.