本文实例讲述了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节点元素属性操作方法_jquery
jquery中选择器与dom节点操作的实例详解
jquery中dom操作实例分析
以上就是jquery实现查找最近父节点的方法的详细内容。