Click to See Complete Forum and Search --> : fetch hidden field value in firefox


bindia
06-26-2007, 11:13 AM
Hi,
I have added a hidden field in one of my web page.But when I try to fetch the value of the hidden field, it throws up an error in firefox.It works fine in IE.

<input type="hidden" id="test" value="false"/>

Now when I called a method to display the hidden filed value using document.getElementById("test").value;....this throws an error in firefox.

How do you fetch the value of a hidden field in firefox?

This is the sample code:
<html>
<head>
<script language=javascript>

function Click(){
ht = document.getElementById('test').value;
alert(ht);

}

</script>
</head>

<body>
<a href="#" onclick="Click();">Click</a>
<input type="hidden" value="false" name="test"/>
</body>
</html>

Please let me know.

Thanks
Bindia

TheBearMay
06-26-2007, 11:42 AM
<input type="hidden" value="false" name="test"/>

should be

<input type="hidden" value="false" id="test" />

if you want to use getElementById