Jquery – Getting the base element from a jQuery object

jquery

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')

Best Solution

$('#MyObject').get(0);

I think that's what you want. I think you can also reference it like a regular array with:

$('#MyObject')[0];

But I'm not sure if that will always work. Stick with the first syntax.