jQuery Highlight Table Row ID
Covering a couple of issues which I encountered.
- How to Highlight a row in a Table on click using jQuery
- How to Only use the above code on that Table
Code:
$(document).ready(function() {
$("table#SearchResultsTable").on('click', 'tr', function () {
var state = $(this).hasClass('highlighted');
$('.highlighted').removeClass('highlighted');
if (!state) {
$(this).addClass('highlighted');
}
});
});
Code to use just your desired Table:
$("table#SearchResultsTable")
Hope the above helps you on your travels.