jquery closest方法
2014-05-07 11:05
288 查看
.closest( selector )
Description: Foreach element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
使用说明:
对于集合(set)中的每一个元素, 通过在文档树中向上遍历这个元素本身和它的祖先元素,来取得第一个与选择符(selector)匹配的那个元素.
举例:
<ul style="float:left"> <li > <table> <tr> <td> this is <span>[Span]</span> party. <div>1 <div>2 <article> <span id="third">3 <div>4 <div>5</div> </div> </span> </article> </div> </div> </td> </tr> </table> </li> </ul>
$("#third").closest("div")
结果为:
<div>2 <article> <span id="third">3 <div>4 <div>5</div> </div> </span> </article> </div>
相关文章推荐
- jquery closest()方法
- jQuery closest() 方法
- 将Java应用程序本地编译为EXE的几种方法
- ----控件组值的取得方法---
- 尹隆森:战略管理分析方法
- Spring与struts的整合方法(转)
- C#破解access数据库密码方法
- 主板上的插线方法!
- 分类器的准确度评估方法
- Install ESX Server 3.5/3i onto ESX Server安装方法
- 十种屏幕抓取方法
- C#中,读取字符串时的切割方法
- 暴风影音2009 去广告的方法
- C#中split的5种方法
- ‘SYSTEM’文件丢失,系统无法启动之解决方法!
- brocade SAN交换机ZONE的配置方法
- MFC中定义全局变量的方法
- 写出高性能SQL语句的35条方法
- CentOS 5.1下跑Mono和Asp.net的实现方法
- MySQL备份和恢复数据表的方法