tags:

views:

25

answers:

1

Hello,

what does this code performs?

if(object.jquery){
  ....
}

I don't know what jQuery attribute does. I think it checks if 'object' is a valid jQuery object, but I'm not really sure.

Thanks in advance.

Esteve

+1  A: 

It's checking if object has a property called jquery, so yes it's checking if object is specifically a jquery object :)

It's not checking if it's been loaded (try it on this very page), that would be if(window.jQuery), but jquery objects have a property called jquery which is the version, for example:

$().jquery //on this page, as of now (when answered): "1.3.2"
Nick Craver