JQuery: Selector to return standard javascript object

For some legacy code I needed a standard a JS object (i.e. not JQuery). You can use JQuery to perform the selection, and then .get() to give you the raw HTML Element Object.

$("#my_selector").get(0)

Note: you have to give .get() a index to return. Even if only one element is in the return list, .get() still returns a an array.

Leave A Reply
All content licensed under the Creative Commons License