次のコードを使用して、3 つの行でテーブルを作成します。1 行目と 3 行目にはデータが含まれています。しかし、2 行目にはデータ自体を含めることができません。つまり、空の行にマウスオーバーすると、それも選択されます。空の行が強調表示されないようにする方法は?
テーブルの作成:
<table id="asdf">
<tbody>
<tr>
<td>Lorem</td> <td>Ipsum</td> <td>Fierent</td>
</tr>
<tr>
<td style="height:10px" colspan=3></td>
</tr>
<tr>
<td >mnesarchum ne </td> <td >sapientem</td> <td >fierent mnesarchum </td>
</tr>
</tbody>
</table>
Jquery for call ホバリング:
$('#asdf tr').mouseover(function() {
$(this).addClass('hovered');
}).mouseout(function() {
$(this).removeClass('hovered');
});
マウスオーバー方法:
.hovered td {
background: #ddd;
}