jquery怎么获取指定列
jquery怎样获得指定列
使用jquery获得指定列的方法:1.新建html项目,引入jquery;2.创建table表格;3.通过标签名获得表格对象,使用find()方法获得指定列;
具体步骤以下:
1.首先,新建一个html项目,并在项目中引入jquery;
<script type="text/javascript" src="/static/jquery⑵.1.4.min.js"></script>
2.引入jquery后,在项目中创建一个table表格;
<table><tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
3.最后,table表格创建好后,通过标签名获得表格对象,在使用find()方法便可获得指定的列;
$(function(){console.log($("table tr").find("td:eq(0)")); //获得表格的第一列
console.log($("table tr").find("td:eq(2)")); //获得表格的第三列
});
文章来源:丸子建站
文章标题:jquery怎么获取指定列
https://www.wanzijz.com/view/2599.html