Possible Duplicate:
How to check a not defined variable in javascript
Determining if a javascript object has a given property
In my beforeSend function i have this
$.myloader.show();
But some scripts dont have that element so my this line gives me error
$.myloader.show(); gives me error that $.myloader does not exists
How can i do something like
if($.myloader exists)
$.myloader.show();
The most generic and solid solution is :
If you’re sure your variable can’t hold anything else than a function or undefined, you might use
But do this only when you’re sure of the possible values because this test also match
false,0and''.