dansays dansays - 2 months ago 11
jQuery Question

Getting the base element from a jQuery object

I'm struggling to find the right terminology here, but if you have jQuery object...

$('#MyObject')


...is it possible to extract the base element? Meaning, the equivalent of this:

document.getElementById('MyObject')

Answer

Yes, use .get(index). According to the documentation:

The .get() method grants access to the DOM nodes underlying each jQuery object.