Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Hiding Form elements until required.

make input forms visible/invisible

4:19 pm on Sep 10, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 1, 2002
votes: 0


Does anyone know how to make form elements(such as an input box text or file)visible/invisible at the click of a button.

Kind Regards


5:09 pm on Sept 10, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
votes: 0

This is a script that works in IE and other new browsers. It actually toggles the element hidden and visible when the function is called. It would be easy to modify:

function showHide(elementid){
if (document.getElementById(elementid).style.display == 'none'){
document.getElementById(elementid).style.display = '';
} else {
document.getElementById(elementid).style.display = 'none';

I don't know how cross browser it is. NN4 won't see it. Then you need to style the element with display:none. Then have what ever is calling it pass the id of the hidden element as an aurgument.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members