当前位置:Gxlcms > JavaScript > jquery 定位input元素的几种方法小结

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

时间:2021-07-01 10:21:17 帮助过:1人阅读

代码如下:

<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"。

人气教程排行