本文實(shí)例講述了jQuery實(shí)現(xiàn)查找最近父節(jié)點(diǎn)的方法。分享給大家供大家參考,具體如下:
這里演示查找當(dāng)前控件最近的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>
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《jQuery操作DOM節(jié)點(diǎn)方法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jquery中Ajax用法總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注