jQuery实现查找最近父节点的方法
来源:动视网
责编:小采
时间:2020-11-27 20:10:57
jQuery实现查找最近父节点的方法
jQuery实现查找最近父节点的方法:本文实例讲述了jQuery实现查找最近父节点的方法,对于jQuery不太熟的同学们,我们一起来学习jQuery吧!这里演示查找当前控件最近的table代码:<html> <head> <title>usually function</title> <
导读jQuery实现查找最近父节点的方法:本文实例讲述了jQuery实现查找最近父节点的方法,对于jQuery不太熟的同学们,我们一起来学习jQuery吧!这里演示查找当前控件最近的table代码:<html> <head> <title>usually function</title> <

本文实例讲述了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吧!这里演示查找当前控件最近的table代码:<html> <head> <title>usually function</title> <