HTML DOM इनपुट कलर ऑब्जेक्ट
इनपुट रंग वस्तु
इनपुट कलर ऑब्जेक्ट एक HTML <इनपुट> एलिमेंट को टाइप = "कलर" के साथ दर्शाता है।
नोट: <input type="color"> IE 11 और पुराने संस्करणों में, या Safari 9.1 और पुराने संस्करणों में समर्थित नहीं है।
एक इनपुट रंग वस्तु तक पहुँचें
आप getElementById() का उपयोग करके टाइप = "रंग" के साथ <इनपुट> तत्व तक पहुंच सकते हैं:
उदाहरण
var x = document.getElementById("myColor");
युक्ति: आप किसी प्रपत्र के तत्वों के संग्रह के माध्यम से खोज कर <input type="color"> तक भी पहुंच सकते हैं ।
एक इनपुट कलर ऑब्जेक्ट बनाएं
आप document.createElement() विधि का उपयोग करके type="color" के साथ एक <input> तत्व बना सकते हैं:
उदाहरण
var x = document.createElement("INPUT");
x.setAttribute("type", "color");
इनपुट रंग वस्तु गुण
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 |
मानक गुण और घटनाएँ
इनपुट कलर ऑब्जेक्ट भी मानक गुणों और घटनाओं का समर्थन करता है ।
संबंधित पृष्ठ
एचटीएमएल ट्यूटोरियल: एचटीएमएल फॉर्म
HTML संदर्भ: HTML <इनपुट> टैग
HTML संदर्भ: HTML <इनपुट> प्रकार विशेषता