浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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.
posted on 2014-03-13 15:05  lexus  阅读(156)  评论(0)    收藏  举报