In ie, the checked attribute of radio or checkbox cannot be selected and displayed in the initial state.
Source: Internet
Author: User
In IE, when using checkbox or radio, you may find that sometimes the checkboxobject cannot be used. checked = true or checkboxobject. the setattribute ('checked', true) method causes the checkbox or radio to be pre-selected.
To solve this problem, you can use the checkultchecked 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 checkbox and radio can be selected in IE in the initial state.
Example:
CopyCodeThe Code is as follows: <SCRIPT type = "text/JavaScript"> <! --
VaR test1 = Document. getelementbyid ("checkboxid ");
Test1.setattribute ('defaultchecked', true );
// --> </SCRIPT>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.