Helpful Information
Home
Categories
Contact us
Category: DOM and JSON scripting
check presence of an HTML element
In Netscape6.0 and IE5.5 and greater, how do I check to see if a HTML element is present ?
Say for example, I have a hidden field
<input type="hidden" name="testField" value="something">
So if the "testField" element is present I want my code to do something or else do something else.
Any ideas ? Thanks in advance.
Vik
if (document.getElementsByName('testField').item(0)) {
//it exists
}
Thanks. It works :)
nice it works for me................thank u very much
privacy (GDPR)