Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery get DOM node? [duplicate]

Tags:

jquery

dom

Possible Duplicate:
How to get a DOM Element from a JQuery Selector

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()?

like image 587
mpen Avatar asked Feb 23 '10 04:02

mpen


1 Answers

You can retrieve DOM elements using array notation:

$("#element_id")[0]

or with get():

$("#element_id").get(0)
like image 58
cletus Avatar answered Oct 26 '22 21:10

cletus