I use the following function for focus on tr, and it works but I have a problem after the function is recalled when a modal window is closed because seems to work only on second click/second double click and I dont understand why.
function rowSelection() {
$('table.grid> tbody > tr > td').click(function () {
var selected = $(this).parent();
$('table.grid> tbody > tr').each(function (index) {
if ($(this).hasClass("selectedRow")) {
$(this).removeClass("selectedRow");
}
});
if (!selected.hasClass('selectedRow')) {
selected.addClass("selectedRow");
}
});
}
If anyone can help. Thank's
You can accomplish the same with the below code
$('table tbody tr').bind('click', function()
{
$(this).toggleClass('selectedRow');
});
here is the working fiddle...
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.