Description: For each 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>
结果为:
<div>2 <article> <span id="third">3 <div>4 <div>5</div> </div> </span> </article> </div>
jquery closest方法,布布扣,bubuko.com
原文:http://blog.csdn.net/u012307002/article/details/25193719