Last Updated: February 25, 2016
·
1.169K
· 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

In what case you need to get the actual DOM?

over 1 year ago ·