Click to See Complete Forum and Search --> : Disable a form field


DiLDoG
01-25-2003, 05:53 AM
How can I disable a form field and make it gray?

Webskater
01-25-2003, 06:13 AM
Use the disabled attribute.

formname.formelement.disabled = true

Sometimes the contents of the element are hard to read when grayed out so I find it just as effective to set things so that every time the control gets the focus the onblur() event is called. The trouble is this does mess up you tabindex if you are using one.