كائن لون الإدخال HTML DOM
كائن لون الإدخال
يمثل كائن Input Color عنصر HTML <input> مع النوع = "color".
ملاحظة: <input type = "color"> غير مدعوم في IE 11 والإصدارات السابقة ، أو في Safari 9.1 والإصدارات السابقة.
قم بالوصول إلى كائن لون الإدخال
يمكنك الوصول إلى عنصر <input> بالنوع = "color" باستخدام getElementById ():
مثال
var x = document.getElementById("myColor");
نصيحة: يمكنك أيضًا الوصول إلى <input type = "color"> من خلال البحث في مجموعة عناصر النموذج.
قم بإنشاء كائن لون الإدخال
يمكنك إنشاء عنصر <input> بالنوع = "color" باستخدام طريقة document.createElement ():
مثال
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 |
الخصائص القياسية والأحداث
يدعم كائن Input Color أيضًا الخصائص والأحداث القياسية .
الصفحات ذات الصلة
دروس HTML: نماذج HTML
مرجع HTML: علامة <input> HTML
مرجع HTML: سمة نوع <إدخال> HTML