This sort of thing can happen a lot if you're writing functions which
take multiple inputs, based on convenience. Being "in control" of your
code shouldn't be a fascist thing like you're describing, where
there's only one way in which everything can or should happen. Having
openness in parameters is always a good thing.

And with that, you'll want to use "instanceof" to solve the problem.

var someObj = document.getElementById('div1'), otherObj = $('<div
id="div2"></div>'), thirdObj = {};

if (someObj instanceof jQuery); // false
if (otherObj instanceof jQuery); // true
if (thirdObj instanceof jQuery); // false

Whereas all options return "object" in a typeof check, instanceof
allows you to compare an object with an instantiation object, like
jQuery.

On Jan 5, 3:57 pm, MorningZ <morni...@gmail.com> wrote:
> I'm trying to grasp the concept of need for this check
>
> What's a situation where you would wonder what it is?   Are you not in
> control of your own code or something?
>
> On Jan 5, 3:53 pm, "Andy Matthews" <amatth...@dealerskins.com> wrote:
>
> > How can I test to see if something is a jQuery object, or a normal
> > JavaScript object?
>
> > andy

Reply via email to