jQuery get() 函数

get() 函数

用于获取当前jQueryobject对象所匹配的DOM元素

语法

jQueryobject.get(index)//因为在JQuery中.很多时候和[]等价所以jQueryobject.get(index)与jQueryobject[index]等价

参数

index:可选,为指定所以,number型

如果指定参数index,则返回包含一个包含所有匹配元素的数组;

返回值

Array/Element

实例说明

代码

<!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></div>
<div>
<ul id="ss">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</div>
<script>
document.writeln( $("div").get(0) );
document.writeln("<br/>")
document.writeln( $("div").get() );
document.writeln("<br/>")
document.writeln( $("ul li").get(0).tagName );
</script>
</body>
</html>

运行结果

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAncAAACQCAIAAADldtomAAAL4UlEQVR4nO3dPVarTBwHYEoXYeEOaCxdivQuw3bWYsM5LsIiLeekdBlvmbfIBzMwkA8zmHifp/FKgMD4v/4yDDLVBgAoo/rtAwCAP0vKAkApUhYASpGyAFCKlAWAUqQsAJQiZQGgFCkLAKVIWQAoRcoCQClSFgBKkbIAUMqiKbter7++vv77778l3xQAfstyKfv6+lpVVVVVj4+Pq9VqfuW2qXbq0G02m82mC3VVVU27/Rq9EL1aVVVVNW3BkwCAMyyUsh8fH1Xk+fl5ZuW26bOyC/Xh323Th2u8vAt1FLltk+QvAPyahVL2/f09TtmHh4fJVdPMjL9vm6ij2n8T9WN1ZwG4JQul7OfnZxyDLy8vk6u2zfhi8DY2J1I2WQwAt2O5cdm3t7dtxD49Pa3X68n1LunLukYMwC1a9B7j7+/v1Wp19B7juDc7GJfNpeymC3XU/e1C0LMF4Cbc6N/L9vcYx1F6WLB/+ZCt/fqVfi0At+JGUxYA/gApCwClSFkAKEXKAkApUhYASpGyAFCKlAWAUqQsAJQiZQGgFCkLAKVIWQAo5XZTtg0eSAzAfVs0Zdfr9dfX19E5eTYb09kB8Bcsl7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udTPH6Z++OvMLwsApUhZAChFygJAKVIWAEqRsgBQipQFgFKkLACUMp2yw8eV9GaeCQIAHMz1ZeefjH3Gc7MB4J8kZQGgFCkLAKVIWQAoRcoCQClSFgBKkbIAUMpZKZvMUS9lAWDeGSnbNkmqSlkAmHf82U+R3WOgPPsJAE7hOcYAUIqUBYBSpCwAlCJlAaAUKQsApUhZAChFygJAKf8Djlh6778OrCwAAAAASUVORK5CYII=" alt="" />

King_dream

2015-04-16 15:58:16

上一篇:深入Android开发之--理解View#onTouchEvent


下一篇:wamp介绍