首页 > Web开发 > 详细

How do I pull a native DOM element from a jQuery object? | jQuery Learning Center

时间:2014-03-14 18:51:37      阅读:503      评论:0      收藏:0      [点我收藏+]

How do I pull a native DOM element from a jQuery object? | jQuery Learning Center

How do I pull a native DOM element from a jQuery object? A jQuery object is an array-like wrapper around one or more DOM elements. To get a reference to the actual DOM elements (instead of the jQuery object), you have two options. The first (and fastest) method is to use array notation: 1 $( "#foo" )[ 0 ]; // Equivalent to document.getElementById( "foo" ) The second method is to use the .get() function: 1 $( "#foo" ).get( 0 ); // Identical to above, only slower. You can also call .get() without any arguments to retrieve a true array of DOM elements.

How do I pull a native DOM element from a jQuery object? | jQuery Learning Center,布布扣,bubuko.com

How do I pull a native DOM element from a jQuery object? | jQuery Learning Center

原文:http://www.cnblogs.com/lexus/p/3598607.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!