Js form elements checked, radio Selected methods (detailed description), checkedradio
0. Environment
<Input type = "checkbox" value = "lol"/> lol
Var lol = document. getElementsByTagName ("input") [0];
1. HTML DOM
A. lol. checked = true;
The attribute value can be not lol, as long as the value is true when it is converted to a Boolean value. The value can only be true or false.
No checked flag is added
B. lol. click ();
The checked flag is not added. The value of lol. checked is true.
2. DOM core
Lol. setAttribute ("checked", "checked ");
When the checked Mark is added to the element, the value of lol. checked is true.
<Input type = "checkbox" checked = "checked" value = "lol"/> lol
In fact, the checked Mark exists as an application, and the following method can be selected by default.
<Input type = "checkbox" checked value = "lol"/> lol
It is selected by default when the browser parses the text.
The above js form elements checked and radio have been selected several methods (detailed description) are all the content that I have shared with you. I hope to give you a reference and support for the help house.