View Full Version : checking if a form element exists on a form

07-23-2002, 06:18 PM
I have a web page that has a html form on it with several hidden <input> tags present on the html form. However depending on how i get to that web page some of the hidden form <input> elelments may not be present.

Now I already have some javascript funtions to manipulate these form elements, but I need to modify them to check if a particular hidden form element exists or not to control which javascript code to execute.

Please help! Cheers. :D

07-23-2002, 07:06 PM
if (typeof document.form_name.element_name != 'undefined') {......
} else {.....

08-19-2002, 06:26 PM
Cheers for the input. I tried the code you gave and it worked a treat. :thumbsup: