手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery实现查找最近父节点的方法
jQuery实现查找最近父节点的方法
摘要:本文实例讲述了jQuery实现查找最近父节点的方法。分享给大家供大家参考,具体如下:这里演示查找当前控件最近的tableusuallyfun...

本文实例讲述了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实现查找最近父节点的方法】相关文章:

javascript实时显示当天日期的方法

jQuery切换所有复选框选中状态的方法

jQuery实现dialog设置focus焦点的方法

js实现鼠标划过给div加透明度的方法

JQuery实现带排序功能的权限选择实例

jQuery实现自动滚动到页面顶端的方法

javascript实现行拖动的方法

js实现div层缓慢收缩与展开的方法

js实现鼠标移到链接文字弹出一个提示层的方法

jQuery的Scrollify插件实现滑动到页面下一节点

精品推荐
分类导航