Home > Web Front-end > JS Tutorial > body text

The checked attribute of radio or checkbox in IE cannot be selected and displayed in the initial state_javascript skills

WBOY
Release: 2016-05-16 18:49:16
Original
1318 people have browsed it

In IE, when using checkbox or radio, you will find that sometimes the checkbox or radio cannot be pre-selected through the CheckBoxObject.checked = true or CheckBoxObject.setAttribute('checked', true) method.
The way to solve this problem is to use the defaultChecked attribute of checkbox or radio to set the defaultChecked attribute to true. The specific implementation is CheckBoxObject.setAttribute('defaultChecked', true) or CheckBoxObject.defaultChecked= true, so that Implement checkbox and radio to be selected in the initial state in IE.
Specific example:

Copy code The code is as follows:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!