我是JS的新手。当用户在可编辑数据表上单击时,如何突出显示所选行?
谢谢。
答案 0 :(得分:0)
如果您使用的是jquery datatable插件,那么这里有一个示例: http://datatables.net/release-datatables/examples/api/select_row.html
$(document).ready(function() {
/* Add/remove class to a row when clicked on */
$('#example tr').click( function() {
$(this).toggleClass('row_selected');
} );
/* Init the table */
var oTable = $('#example').dataTable( );
} );
/*
* I don't actually use this here, but it is provided as it might be useful and demonstrates
* getting the TR nodes from DataTables
*/
function fnGetSelected( oTableLocal )
{
return oTableLocal.$('tr.row_selected');
}