此问题可能会被复制,但我没有找到有用的东西。
不管怎么说,这是我的HTML代码:获取jQuery元素的第二个子元素
<table>
<thead>
<tr>
<th>foo</th>
<th>foo</th>
<th>foo</th>
</tr>
</thead>
<tbody>
<tr>
<td>bar</td>
<td>bar</td>
<td>bar</td>
</tr>
</tbody>
这是我的jQuery代码:
$("table tbody tr").hover(
function() {
var secondCell = $(this).children[1].textContent;
//secondCell.someCode
},
function() {
//some code
}
);
所有我想要做的是:
当玩家徘徊一行时,它应提醒他们是一条消息,并且该消息具有第二个单元格文本。
希望你明白了,并提前致谢。
$(“tr td:nth-child(2)”)。 – Kiloreux