having problems with javascript null
- by user165242
I have tried rectifying the code below. But I am not able to find a solution. After executing the code, firebug says "document.getElementById(haystack.value) is null". I tried if(document.getElementById(haystack).value ==null) but it was of no use. Please help me out.
var haystack=document.getElementById('city1').value;
if(!document.getElementById(haystack).value)
{
alert("null");
}
else
{
alert("not null");
}