我想写一个js用于获取某个对象现在有一个input 在一个table里面<table id="tblGrid2">
<input tabindex=12/>
<input tabindex=13/>
</table>
如何通过this获取<input tabindex=13/>这个对象。类似如下,不过如下这个是不行的。
$(":input[tabindex=" + tabIndex + "]", this).focus();this 是table的对象。
<input tabindex=12/>
<input tabindex=13/>
</table>
如何通过this获取<input tabindex=13/>这个对象。类似如下,不过如下这个是不行的。
$(":input[tabindex=" + tabIndex + "]", this).focus();this 是table的对象。
解决方案 »
- window.opener.location.href 跨域访问 在IE6,IE7,IE8等IE浏览器中无效
- juqery实现:原来的焦点在一个文本框上面,点击一个按钮得到失去焦点的文本框的值????????
- 问一个关于VML饼图的问题!!急求啊~拜托了~!
- 可控制网页的下面的滚动条
- 高分求解 cookie 如何对应保存 并要的时候调出来
- 100分求一js小程序,不知道怎么称呼
- !JavaScript怎么调用SHBrowseForFolder这个API?
- js中这个程序为什么会出错??究竟是什么含义?
- 怎样让在输入框的文字居中?<input>
- js判断本月是否操作过此问题
- 匹配字符串,正则表达式或者别的实现方法
- 很奇怪,我自定义的类,实例化后alert,都弹出[object,Object],为什么Array弹出的是字符串,请问它里面怎么写的?
var tabIndex = 13;
$(":input[tabindex='" + tabIndex + "']", $("#tblGrid2")).focus();
<table id="tblGrid2">
<tr>
<td>
<input tabindex=12/>
<input tabindex=13/>
</td>
</tr>
</table>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$('table').each(function(){
alert( $(":input[tabindex=12]", this).attr('tabindex') )
})
</script>
<input tabindex=12/>
<input tabindex=13/>
</table>ff下生成的结构是这样的
<input tabindex="12/">
<input tabindex="13/">
<table id="tblGrid2"> </table>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>修改对象原型</title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
$(":input[tabindex='13']", $("#tblGrid2")).focus();
}
</script>
</head>
<body>
<table id="tblGrid2">
<input tabindex=12 />
<input tabindex=13/>
</table>
</body>
</html>
</body>
</html>
<script type="text/javascript">
window.onload=function(){
$(":input[tabindex='13']", $("#tblGrid2")).focus();
}
</script>