obj instanceof jQuery或obj instanceof $可以判断出一个对象是否为jQuery对象的。
要判断一个javascript的对象是什么类型,可以使用typeof,但是typeof只能判断出js的基础对象(string,boolean,number,object, ect.)。
var obj = $("body"); if(obj instanceof jQuery){ alert("这是一个jQuery对象"); }else{ alert("这是一个其它对象") }