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
Written by Picrasma-Excelsa
Related protips
2 Responses
In what case you need to get the actual DOM?
over 1 year ago
·
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Tags
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#