jquery点击tr换背景颜色

jquery点击tr换tr的背景颜色,table的id为db-list1
jQuery(function() { jQuery("#db-list1 tr").click( function() { if (jQuery(this).hasClass("selected")) { jQuery(this).removeClass("selected"); jQuery(this).css("backgroundColor", "#ffffff"); jQuery(this).children().eq(1).children().attr('checked', false); } else { jQuery(this).addClass("selected"); jQuery(this).css("backgroundColor", "#b0d8ff"); jQuery(this).children().eq(1).children().attr('checked', true); } }); });

猜你喜欢

转载自www.cnblogs.com/TimeSay/p/9140295.html
今日推荐