كائن راديو الإدخال HTML DOM
كائن راديو الإدخال
يمثل كائن "راديو الإدخال" عنصر <input> بتنسيق HTML مع النوع = "راديو".
الوصول إلى كائن راديو الإدخال
يمكنك الوصول إلى عنصر <input> من خلال النوع = "radio" باستخدام getElementById ():
مثال
var x = document.getElementById("myRadio");
نصيحة: يمكنك أيضًا الوصول إلى <input type = "radio"> بالبحث في مجموعة عناصر النموذج.
قم بإنشاء كائن راديو الإدخال
يمكنك إنشاء عنصر <input> مع type = "radio" باستخدام طريقة document.createElement ():
مثال
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
إدخال خصائص كائن الراديو
Property | Description |
---|---|
autofocus | Sets or returns whether a radio button should automatically get focus when the page loads |
checked | Sets or returns the checked state of a radio button |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a radio button |
disabled | Sets or returns whether the radio button is disabled, or not |
form | Returns a reference to the form that contains the radio button |
name | Sets or returns the value of the name attribute of a radio button |
required | Sets or returns whether the radio button must be checked before submitting a form |
type | Returns which type of form element the radio button is |
value | Sets or returns the value of the value attribute of the radio button |
الخصائص القياسية والأحداث
يدعم كائن Input Radio أيضًا الخصائص والأحداث القياسية .
الصفحات ذات الصلة
دروس HTML: نماذج HTML
مرجع HTML: علامة <input> HTML
مرجع HTML: سمة نوع <إدخال> HTML