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
  • 896
  • 1
  • 10
  • 37

3 Answers3

2

Try checking it by using instanceof

var isJqueryObject = object1 instanceof jQuery

Menztrual
  • 40,867
  • 12
  • 57
  • 70
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
  • 732,580
  • 175
  • 1,330
  • 1,459
Hemen Ashodia
  • 202
  • 2
  • 4
  • 21
0

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

bukart
  • 4,906
  • 2
  • 21
  • 40