Hello i have a table and i want to highlight table td when i click it. I managed to make it work but only on half. It change's the td when i select another but only on that row, what i want is to select only 1 td. Here is my js code
<script>
$(".table").on("click", "td", function() {
$(this).closest("td").siblings().removeClass("td_select");
$(this).toggleClass("td_select");
$("#basicModal").modal("show");
});
</script>
If I got you correctly, you need this:
$(this).closest("table").find('td').removeClass("td_select");
//in the current table, find all cells, and remove the highlight
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.