Det ' handicappet ' er en attribut for tag i HTML, som bruges til at angive, at knappen er deaktiveret. Det er en boolsk attribut. Den deaktiverede knap kan ikke bruges til at klikke, og den vises som en grå farve.
Syntaks
Text you want to show on the button
Eksempler: Følgende eksempler bruger forskellige knapper og gør dem deaktiverede.
Eksempel 1: Følgende eksempel deaktiverer indsend-knappen.
Example of Submit Disabled /* The following tag selector body use the font-family and background-color properties for body of a page*/ body { font-family: Calibri, Helvetica, sans-serif; background-color: pink; } /* Following container class used padding for generate space around it, and also use a background-color for specify the color lightblue as a background */ .container { padding: 50px; background-color: lightblue; } /* The following tag selector input uses the different properties for the text filed. */ input[type=text] { width: 100%; padding: 15px; margin: 5px 0 22px 0; display: inline-block; border: none; background: #f1f1f1; } input[type=text]:focus { background-color: orange; outline: none; } div { padding: 10px 0; } /* The following tag selector button uses the different properties for the Button. */ button { color: red; padding: 16px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; opacity: 0.9; } Firstname: Middlename: Lastname: Gender : <br> Male Female Other Email: In this example, the disabled attribute is used to disable the Reset button. If you fill the form and then click on the 'Reset a form' button, then it will not reset the values of the above form. Reset a FormTest det nu
Produktion:
Browser support
Element | Chrome | IE | Firefox | Opera | Safari |
Ja | Ja | Ja | Ja | Ja |