jQuery选择器

1、:first和:first-child

 <ul>
    <legend>UL</legend>
    <li>1</li>
    <li>2</li>
    <li>3</li>
 </ul>

$('ul li:first-child')     1.有legend [];  2.没有legend [<li>1</li>]

2、:last和:last-child

3、:eq(index)和:nth-child(index)   eq从0开始,nth-child从1开始

总结:前面的查找结果集的指定元素,后面的查找指定元素子元素结果集中的元素

原文地址:https://www.cnblogs.com/dddbj/p/5776468.html