当前位置:首页 >> 网络编程

jquery 定位input元素的几种方法小结

复制代码 代码如下:
<html>
<table class=”ed”>
<tr>
<td><input type="text"></input></td>
<td><input type="text"></input></td>
<td><input type="button"></input></td>
<td><input type="text"></input></td>
</tr>
</table>
</html>

需要定位到第三个文本框的时候:
复制代码 代码如下:
$(“.ed input:text)”).eq(3)
$(“.ed input:text:eq(3)”)
$(“.ed input[type=”text”]”).eq(3)
$(“.ed input[type=”text”]:eq(3)”)

其中.ed中ed是class="ed"。