oqb7bw
Last Updated: February 25, 2016
·
791
· florenceokosun

How to pull a native DOM element from a jQuery object

You might want to get a reference to the actual DOM elements instead of the jQuery object. To do this, you have two options. First, is to use array notation

$( "#foo" )[ 0 ]; // Equivalent to document.getElementById( "foo" )

Second is to use the .get() function:

$( "#foo" ).get( 0 ); // Identical to above, only slower.

Get to know more: http://learn.jquery.com/using-jquery-core

2 Responses
Add your response

18718

In what case you need to get the actual DOM?

over 1 year ago ·