[thelist] [javaScript] removing values from forms

Matt McKeon matt at camadro.com
Wed Jul 8 08:42:43 CDT 2009

Tris wrote:
> I'm trying to clear an input box is the default value is not changed..
> Here's what I've got and can't figure why it's not working...?
> Thoughts...?
>   function clearBox(inputName, inputDisplay) {
>     if (document.addUser.inputName.value = inputDisplay) {
>       document.addUser.inputName.value = '';
>     }
>   }
In the above if statement, you are doing an assignment rather then a
equality test. So the value of the input keeps getting set to
inputDisplay rather then being tested against that value.
Changing it to == should help.


More information about the thelist mailing list