jQuery.first() 函数

first() 函数详解 函数

获取当前对象的第一个元素

语法

$selector.first()

返回值

返回值为一个对象

实例说明

代码

jQuery.first() 函数

<!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 class="li">one</li>
<li id="two" class="li">two</li>
<li>three</li>
</ul>
</div>
<script>
document.writeln( $("li").first().attr("class"));//返回第一个li的类名
document.writeln( $("li").first());//返回是一个对象
</script>
</body>
</html>

jQuery.first() 函数

运行结果

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJsAAACCCAIAAADe2i2IAAAEhUlEQVR4nO2dMXKDMBBFVeYQKXIDmpQ5StTnGGl1ljSaySFSuGXGZY6RUikwaBESARuF9ee/Jg4w9trPawQsKxMIFmbvAMjG0CgaNIoGjaJBo2jQKBo0igaNokGjaNAoGjSKBo2iQaNo0CgaNIoGjaJBo2hUN3o+n7++vn5+fmq/EOmoa/T19dUYY4x5fHw8nU7zG3trLjSuDSGE0LrGGGN991esEGuNMcZYX/FN3BkVjX58fBjB8/PzzMbeRi+ta4bH3kaRcnnrGqHX25HrQ1PR6Pv7uzT68PBQ3HTsR/7vrUjA+I/IT6bpmIpGPz8/5Uf+8vJS3NTb6Q9qp6hgdLSYSOruR9/e3jqdT09P5/O5uN01Ocrf2TzVx7rf39+n0+nPsa7M0mQ/mjMaWteItG6dY8ZeUHQ8Gse6UtuwoF89eIzbG+ZrRJFRsgk0igaNokGjaNAoGjSKBo2iQaNo0CgaNIoGjaKhy6h3PEF7K5rqjHiJbAuU1BmJ6yjx6stlofXdg8b57lpMvOrNSy9TtNQZhZDL0dY1fSlDfwXcDVfCs3VJREedUUfmV/eidLi+fRFarnkgOuqMOnJeuuT0ztrGepmhhbokoqPOqCObad42zjnXtq6xri8+YY6W0VJnFMIo07yXxUVDVcqo5Chbl0SUHY/2w1chaDo6SjemTokuo+R2aBQNGkWDRtGgUTRoFA0aRYNG0dBvVJw+IgtQbbTvw7B3HHeFaqOBN3OvR5fRaZ0Rja5Fe50Rja5Fc53RZcW0n1Hu3m95C3++z9FB+h/prjMq9zPqVlnbpXBcU+pzdJz+R8rrjIqdNUJ6CXx4inGyR9HZ5YDorzOaMzrRUtrtHmh3rL3OaKXRUsHRgQqRtNcZrTRa7HN0nP5Hyo5HbX7vl/QzSvaKiddSn6OD9D/SZZTcDo2iQaNo0CgaNIoGjaJBo2jQKBo0igaNokGjaNAoGjSKBo2iQaNo0CgaNIoGjaJBo2jQKBo0igaNokGjaFQ1KupqkStk/4EVtcaVja4oXb+Xfgs7x/nn5Ayp0fRWzenaFdm21Oiyfgu5e9FqEn9hxnMW7xvnaqMdMzcE1TAaFt089q9G5TuVvXx3j3NjoyvZ1ugGLJ5PJmmbHqPbPU4aFSx/V+U++LvHuZ3RyVT3i0LLGc3O05LttzD/4mv6LRT7PORJjcYFu8e5/X70RqOleVpkv4XpBzp98Zl+C0Y8vm5+gulwQRrdN05lRsuxL7vZdzTZQO7bnP+MV0f/R47uGacyo0v3T9nXkQuv6rewPPrMN09LnMqMbpmj2UA2MpoZ62qJU5nR8jwtC+ZBS/dP2b4K44PB1lkRbn4+mQIi0OR4dN84rz9nlA7axqOwpSOM+bGu/La7fubC4rOnX6cr+i3k5pOZiT49Z6QhzitzdCM2OFMf80P3zEuV49Rypn4L7mXmJTVxqjdKVkKjaNAoGjSKBo2iQaNo0CgaNIoGjaJBo2jQKBo0igaNokGjaNAoGjSKBo2iQaNo0CgaNIoGjaJBo2jQKBo0igaNokGjaPwC9U3I7vMeuncAAAAASUVORK5CYII=" alt="" />

King_dream

2015-04-16 17:52:24

上一篇:安装WampServer时出现的问题(丢失VCRUNTIME140.dll或MSVCR110.dll)以及解决办法


下一篇:C# DataTable怎么合计字段