Page 1 of 1

how to hide a text box when a button is clicked

Posted: Thu Feb 01, 2007 9:50 pm
by chitrapu
i have a text box and a button in a form. when i click on the button is it possible to hide the textbox? the textbox should not appear on the screen after the button is clicked

Re: how to hide a text box when a button is clicked

Posted: Thu Feb 01, 2007 9:57 pm
by wildwobby
chitrapu wrote:i have a text box and a button in a form. when i click on the button is it possible to hide the textbox? the textbox should not appear on the screen after the button is clicked
use javascript.

put the textbox in a div and do somthing like:

Code: Select all

function hideTextbox(div) {
var textbox = document.getElementById['div'];

textbox.style.visibility = 'hidden'; //hides text box
}
on the button add a action or what ever its called so it is like onSubmit = hideTextbox(textfield);


Im no Javascript pro, but i think thats how its done.

Posted: Thu Feb 01, 2007 9:57 pm
by Burrito

Code: Select all

document.getElementById('whatever').style.display = "none";

Posted: Thu Feb 01, 2007 10:08 pm
by superdezign
You don't sound like you're aware so, just so you know, backwards compatibility (for people who don't have IE7 yet, or people who refuse to upgrade browsers) use document.all['whatever'].style and document.layers['whatever']

Re: how to hide a text box when a button is clicked

Posted: Thu Feb 01, 2007 10:23 pm
by chitrapu
thank a lot its working , but i have the same problem with a buttonalso . that code does is not working for a button.

Posted: Thu Feb 01, 2007 10:34 pm
by superdezign
What...? You mean displaying/hiding buttons? I'm not sure I understood what you asked.