本文实例讲述了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程序设计有所帮助。