Reputation: 4239
I am having a weird issue in IE.
I have
The tool variable can be empty and it seems like that I need to have
tool==''
to make IE happy.
//work in IE and other browsers..
if(tool==null || tool==''){Alert('bang!!!');}
//doesn't work in IE but not other browsers.
if(tool==null){Alert('bang!!!');}
What's going on here?
Upvotes: 0
Views: 43
Reputation: 21114
This article: http://saladwithsteve.com/2008/02/javascript-undefined-vs-null.html explains it very well.
You can use if(!tool) alert('bang');
Upvotes: 0
Reputation: 87073
Try this:
if( !tool ){
Alert('bang!!!');
}
Here, !tool
will return true
if tool = null
or tool = ''
.
Upvotes: 1