eq() 函数
获取当前对象中指定索引所对应的的元素
语法
$selector.eq(index)//index为指定索引,值为数字型
返回值
返回值为一个对象
实例说明
代码
<!DOCTYPE html>
<html lang="zh-CN">
<head lang="en">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> </head>
<body>
<div></div>
<div id="div"></div>
<div>
<ul>
<li>one</li>
<li id="two" class="li">two</li>
<li>three</li>
</ul>
</div>
<script>
document.writeln( $("li").eq(1).attr("class"));//class="li"
document.writeln( $("li").eq(1).attr("id"));//id="two" </script>
</body>
</html>
运行结果
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG0AAAByCAIAAADWGshPAAADbUlEQVR4nO2cPZLiMBBGFXIIAm7ghJCjoJxjkOosJKriEAROXeWQYxBqA//JtsSimU+ovfu9ZMBSMfhVI9ndlpQjCFTpL/CPQI8Y6BEDPWKgRwz0iIEeMdAjBnrEQI8Y6BEDPWKgRwz0iIEeMdAjBnrEQI8Y6BFDdo9t2z4ej9frlfsflSWvx/P5rJRSSu33+7qu33e2WvVUpnHOOdeYSimlbffXa/BalVJKaZvxJD4io8fb7aY8jsfjm85WTzYaU42vrZ70+ccbU3lSrZ4ZLkBGj9fr1fe42+2iXedW/PdWe8E2vfFiUUZIZvR4v9/9Ez2dTtGuVq9/sp2YiMfZYQnkHR8vl0sn8XA4tG0b7feTeCz9S56Tfb5+Pp91Xf91vvYjcjE+hjy6xlReCDfGFI5OQdeP03ztyxoPDM2jvam/Kh+bgjxuGnrEQI8Y6BEDPWKgRwz0iIEeMdAjBnrEQI8YZHm0pviN8g+RVJ8RlwxLQEh9xsvdTBmf/qC23YvK2C7/M+VyxaR7xNRnnAvFY2OqIS0+5HXNmN8N1nNKIaM+0xH4Xfcix6xtrzGePy+FjPpMR8hGF4jWaF1p60djpJ5TChn1mY5gVFldGWNM05hKm6F88F/FY8eH9RnnZlFlrV+UGesKs1JNsJ5TCmHXj8MU7GlZzzXLzsUlOmketws9YqBHDPSIgR4x0CMGesRAj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