Disable a color picker:
document.getElementById("myColor").disabled = true;
Click the button to disable the color picker above.
<!DOCTYPE html> <html> <body> <input type="color" id="myColor"> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*w w w. j a va 2 s. c o m*/ document.getElementById("myColor").disabled = true; } </script> </body> </html>
The disabled
property sets or gets whether a color picker should be disabled, or not.
This property mirrors the HTML disabled attribute.
The disabled
property accepts and returns a boolean type.
Value | Description |
---|---|
true | The color picker is disabled |
false | Default. The color picker is not disabled |