Sometimes, when developing a scenario for the behavior of a web surfer on a site page, it becomes necessary to deprive him of the opportunity to click one or another button placed in a document. This is very often used when filling out forms, when it is necessary that some fields have been filled in by the time the user clicks the button. The following describes the HTML syntax for deactivating several types of buttons used in web forms.
Necessary
Basic knowledge of HTML
Instructions
Step 1
The disabled attribute is provided to disable most HTML (HyperText Markup Language) page elements. To display an inactive button (button) in any form on the page, you need to use something like the following code:
Inactive button
It is not necessary to specify the value disabled for the disabled attribute - to deactivate it, the presence of this attribute alone, without any value, is sufficient. But, according to the HTML specification, the value must still be specified, and if you check the page with a validator, then in the absence of a value, it will indicate the presence of an error in the code.
Step 2
For another type of buttons (submit), by default, intended for submitting data from a form to the server, you must use exactly the same deactivation syntax. For example:
Step 3
And for buttons used to clear filled text form elements (reset), only the element type needs to be replaced, leaving the deactivation attribute unchanged. Sample:
Step 4
Even for a button that launches a dialog box to find and open a file (file), the same HTML syntax is valid: