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? | 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,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。