我的table不是页面一开始就有的,是点击查询后根据结果动态生成的table,然后用$('#gg').html(htmlStr); htmlStr为拼成的table,请问我如何实现点击当前table 行改变颜色,
$('#gg').html(htmlStr).find('tr').toggleClass('xxxx');;
$(function(){ $("tr").click(function(){ $("tr").css("background-color",""); $(this).css("background-color","#ff0f0f"); }); });$(function(){ $("tr").click(function(){ $("tr").css("background-color",""); $(this).css("background-color","#ff0f0f"); }); });