【发布时间】:2012-10-01 18:58:40
【问题描述】:
可能重复:
How to check a not defined variable in javascript
Determining if a javascript object has a given property
在我的 beforeSend 函数中我有这个
$.myloader.show();
但是有些脚本没有那个元素,所以我的这一行给了我错误
$.myloader.show(); 告诉我 $.myloader 不存在的错误
我该怎么做
if($.myloader exists)
$.myloader.show();
【问题讨论】:
-
或stackoverflow.com/questions/858181/…(以及右侧可见的其他链接...)
-
尝试 { some_var.xxx.xxx.xxx x = 't'; }catch(e){ x = 'f'; } console.debug(x);
标签: javascript jquery