HTML 代码:
<table id="tab">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</table>
目的:找到第一列的数据
用到标签:JQuery 对象访问标签 each() 、 $(this) 想得到 jQuery对象 、选择器->子元素
JQuery 代码:
$(document).ready
(
function()
{
$("button").click
(
function()
{
$("#tab tr td:nth-child(1)").each
(
function()
{
alert($(this).text());
}
);
}
)
}
);