
如何判断一个对象是否为jquery对象
1个回答
2015-07-19 · 知道合伙人数码行家

知道合伙人数码行家
采纳数:117525
获赞数:517240
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注

展开全部
判断一个对象是否为jquery对象可以用 obj instanceof jQuery
例如:
var obj = $("div");
if(obj instanceof jQuery){
alert("这是一个jQuery对象");
}else{
alert("这是一个其它对象")
}
$(".otherWeek").each(function(){
console.info(this instanceof jQuery); //false
console.info($(this) instanceof jQuery); //true
})
例如:
var obj = $("div");
if(obj instanceof jQuery){
alert("这是一个jQuery对象");
}else{
alert("这是一个其它对象")
}
$(".otherWeek").each(function(){
console.info(this instanceof jQuery); //false
console.info($(this) instanceof jQuery); //true
})
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询