Oggetto colore di input HTML DOM
Inserisci colore oggetto
L'oggetto Input Color rappresenta un elemento HTML <input> con type="color".
Nota: <input type="color"> non è supportato in IE 11 e versioni precedenti o in Safari 9.1 e versioni precedenti.
Accedi a un oggetto Colore di input
Puoi accedere a un elemento <input> con type="color" usando getElementById():
Esempio
var x = document.getElementById("myColor");
Suggerimento: puoi anche accedere a <input type="color"> cercando nella raccolta di elementi di un modulo.
Crea un oggetto Colore di input
Puoi creare un elemento <input> con type="color" usando il metodo document.createElement():
Esempio
var x = document.createElement("INPUT");
x.setAttribute("type", "color");
Inserisci le proprietà dell'oggetto colore
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a color picker |
autofocus | Sets or returns whether a color picker should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a color picker |
disabled | Sets or returns whether a color picker is disabled, or not |
form | Returns a reference to the form that contains the color picker |
list | Returns a reference to the <datalist> element that contains the color picker |
name | Sets or returns the value of the name attribute of a color picker |
type | Returns which type of form element the color picker is |
value | Sets or returns the value of the value attribute of a color picker |
Proprietà ed eventi standard
L'oggetto Input Color supporta anche le proprietà e gli eventi standard .
Pagine correlate
Esercitazione HTML: Moduli HTML
Riferimento HTML: tag HTML <input>
Riferimento HTML: attributo tipo HTML <input>