AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > JavaScript

jQuery实现查找最近父节点的方法

51自学网 http://www.wanshiok.com
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操作DOM节点方法总结》、《jQuery扩展技巧总结》、《jQuery常用插件及用法总结》、《jQuery拖拽特效与技巧总结》、《jQuery表格(table)操作技巧汇总》、《jquery中Ajax用法总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》及《jquery选择器用法总结

希望本文所述对大家jQuery程序设计有所帮助。


jQuery,查找,最近父节点  
上一篇:每日十条JavaScript经验技巧(二)  下一篇:浅谈jquery中的each方法$.each、this.each、$.fn.each