Disabling Form Elements

In some cases, you may not want visitors to use certain parts of your form. For example, you might want to disable a submit button until all the required fields have been filled out.

Figure 17.58. Here, I use JavaScript and the disabled attribute to make the submit button inaccessible until other options are selected.

To disable a form element:

In the form element’s tag, type disabled="disabled".

Figure 17.59. When the visitor first views the form, nothing is selected and the submit button is disabled.

Figure 17.60. ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.