0

So, i have two objects:

var object1 = $('div');
var object2 = {};

How i can define is this jQuery object, or not?

for javascript version < 1.4

Andrey Vorobyev
  • 861
  • 1
  • 10
  • 37

3 Answers3

2

Try checking it by using instanceof

var isJqueryObject = object1 instanceof jQuery

Menztrual
  • 39,494
  • 12
  • 56
  • 69
1
var abc={};

if(typeof(abc.jquery)=="undefined"){

console.log("object is not a jquery object");

}else{

console.log("object is a jQuery object");

}

if object is jQuery object then

objectIdentifier.jquery =< version of jQuery>
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Hemen Ashodia
  • 182
  • 2
  • 3
  • 20
0

try it this way var isJQ = ( object1 && jQuery == object.constructor);

bukart
  • 4,856
  • 2
  • 19
  • 40