时间:2021-07-01 10:21:17 帮助过:5人阅读
这里演示查找当前控件最近的table代码:
<html>
<head>
<title>usually function</title>
</head>
<body>
<table name="name_table1">
<tr>
<td>table1</td>
</tr>
</table>
<table name="name_table2">
<tr>
<td>table2</td>
</tr>
</table>
<table name="name_table3">
<tr>
<td>table3</td>
</tr>
</table>
</body>
<html>
<script type="text/javascript" src="jquery-1.4.4.js"></script>
<script>
$(function(){
$("td").bind("click",function(){
//alert($(this).html());
alert($(this).closest("table").attr("name"));
});
});
</script>以上就是jQuery实现查找最近父节点的方法,更多jQuery相关的内容请在本站进行搜索哦~
相关推荐:
JQuery节点元素属性操作方法_jquery
JQuery中选择器与DOM节点操作的实例详解
jQuery中DOM操作实例分析
以上就是jQuery实现查找最近父节点的方法的详细内容,更多请关注Gxl网其它相关文章!