PDA

View Full Version : style.display to hide a form button



sir pannels
Mar 8th, 2007, 06:40 PM
Hi all,

I'm trying to hide a form button in javascipt.
Within a function I have the following ...


document.getElementById(button).display='none';


However it just errors and says button is undefined. button is the id and name of the form button btw.

Do I need to define which form it is part of or something else?

Many thanks for any pointers or help.

Sir P :D

nikkiH
Mar 8th, 2007, 06:47 PM
It has to already have a default inline style to do this, I believe.
Also, you don't show what button is. It needs to be an id, so verify that.

sir pannels
Mar 8th, 2007, 07:03 PM
I'm sorry I did not understand, can you rephrase?

glenngv
Mar 8th, 2007, 07:07 PM
document.getElementById("button").style.display='none';

sir pannels
Mar 8th, 2007, 07:26 PM
Ah I understand, excellent missed out the style...
thanks very much for that :)

zXcongducXz
Jun 14th, 2010, 03:57 PM
document.getElementById("button").style.display='none';

how can it display button again?