[ jquery 选择器 :eq(index) ] 此方法精确选取指定jquery对象中的指定下角标的对象

匹配一个给定索引值的元素:从 0 开始计数

<!DOCTYPE html>
<html lang='zh-cn'>
<head>
<title>Insert you title</title>
<meta http-equiv='description' content='this is my page'>
<meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
<script type='text/javascript'>
    $(function(){
       var name = $('#list li:eq(1)').get(0).className;
       alert(name);
    });    
</script>
</head>
<body>
    <ul id='list'>
        <li></li>
        <li class='eq-selector'></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>

 

posted @ 2016-06-22 07:11  窗棂  Views(646)  Comments(0Edit  收藏  举报