[英]Toggle class on each tr row when clicked
For some reason I can't get the class of "selected" to toggle on when each row is clicked 由于某些原因,单击每一行时无法打开“选择”类
$("tr").click(function() {
$(this).toggleClass('selected');
};
table tr.user:hover {
background: #007A00;
}
table tr.selected {
background: #198719;
}
Should be a simple fix, but I can't see what I'm doing wrong. 应该是一个简单的修复程序,但是我看不到我在做什么错。
$("tr").click(function() {
$(this).toggleClass('selected');
});
You are missing a closing bracket at the end. 您最后缺少一个右括号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.