Javascript examples for DOM HTML Element:Input Color
The disabled property sets or gets whether a color picker is disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a color picker should be disabled or not |
A Boolean, returns true if the color picker is disabled, otherwise it returns false
The following code shows how to Disable a color picker:
<!DOCTYPE html> <html> <body> <input type="color" id="myColor"><br><br> <button onclick="disableBtn()">Disable Color Picker</button> <button onclick="undisableBtn()">Enable Color Picker</button> <script> function disableBtn() {//from w w w . j av a 2 s . c om document.getElementById("myColor").disabled = true; } function undisableBtn() { document.getElementById("myColor").disabled = false; } </script> </body> </html>