Reputation: 23
I have code that dynamically generates rows of the table where the first column of each row is checkbox:
let tr = $("<tr class='clickable-row'></tr>");
tr.append(`<td><input type="checkbox" class="checkbox"></td>`);
...
OnClick event displays the details of the row.
$(document).on("click", ".clickable-row", function (e) {
measurementManager.displayMeasurementsInfo(this);
});
Upvotes: 2
Views: 1520
Reputation: 53198
You need to stop the event from propagating when the first <td>
element is clicked. Add the following:
$(document).on('click', '.clickable-row td:first', function(e) { e.stopPropagation() });
Upvotes: 3