Below is a code snippet, where we retrieve a form value.
Before further processing check if the value is not null..
var val = document.FileList.hiddenInfo.value;
alert("val is " + val); // this prints null which is as expected
if (val != null)
{
alert("value is "+val.length); // this returns 4
}
else
{
alert("value* is null");
}
Any ideas why it happens so.. ??
It’s because val is not
null, but contains'null'as a string.Try to check with ‘null’
For an explanation of when and why this works, see the details below.