本文实例讲述了jquery实现查找最近父节点的方法,对于jquery不太熟的同学们,我们一起来学习jquery吧!
这里演示查找当前控件最近的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实现查找最近父节点的方法的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号