如何在TR中将TD上的TD的鼠标悬停绑定?
问题描述:
这是我的HTML:
<table id="myTable">
<tr class="myTr">
<td>
CELL 1
</td>
<td>
Cell 2
</td>
<td class="notThis">
Cell 3
</td>
</tr>
<tr class="myTr">
<td>
2- CELL 1
</td>
<td>
2- Cell 2
</td>
<td>
2- Cell 3
</td>
</tr>
</table>
<div id="myDiv">CONSOLE</div>
还有我的Javascript:
And my Javascript:
$(document).ready( function() {
$(".myTr").mouseover( function() {
$("#myDiv").html( "OVER" );
} );
});
我想要它,以便当您将鼠标悬停在"notThis"单元格上时,不会触发鼠标悬停.我设置了一个小提琴进行测试: http://jsfiddle.net/S7bfH/3/
I want it so that when you mouseover the "notThis" cell, the mouseover doesn't trigger. I have a fiddle set up for testing: http://jsfiddle.net/S7bfH/3/
谢谢
答
此处:
$(".myTr td:not('.notThis')").hover( function() {
$("#myDiv").html( "ACTIVE" );
}, function() {
$("#myDiv").html( "INACTIVE" );
});