tags:

views:

520

answers:

3

I can select a node using jQuery with something like $('#element_id') but how would I get the DOM element for use with non-jQuery functions that expect something like would be returned by document.getElementById()?

+10  A: 

You can retrieve DOM elements using array notation:

$("#element_id")[0]

or with get():

$("#element_id").get(0)
cletus
Works perfectly, thank you :) I was looking through the jQuery API but I wasn't quite sure what to look for. All I found was `.context`.
Mark
+1  A: 
$('#element_id').get()
leo-the-manic
Doesn't work without the `0` :) Close though. +1
Mark
A: 

$('#element_id') and document.getElementById() both returns the same object. even jquery calls the document.getElementbyId internally. if u can explain that is non-jQuery fn, then i could suggest some thing.

coder
The jQuery function returns a jQuery object and not raw DOM objects.
leo-the-manic