How to get a DOM Element from a jQuery selector?

I’m having an impossibly hard time finding out to get the actual DOMElement from a jQuery selector.

Sample Code:

<input type="checkbox" id="bob" />
var checkbox = $("#bob").click(function() { //some code  } )

and in another piece of code I’m trying to determine the checked value of the checkbox.

  if ( checkbox.eq(0).SomeMethodToGetARealDomElement().checked )
    //do something.

And please, I do not want to do:

  if ( checkbox.eq(0).is(":checked"))
    //do something

That gets me around the checkbox, but other times I’ve needed the real DOMElement.

4 Answers
4

Leave a Comment