0. Environment
<input type= "checkbox" value= "LOL"/>lol
var lol = document.getelementsbytagname ("input") [0];
1, HTML DOM
A.lol.checked = true;
The value of the property can be not lol, as long as it is true when converted to a Boolean value, only true, false two when the value is taken
No checked markup added
B.lol.click ();
The checked tag is not incremented, then the lol.checked value is True
2. DOM Core
Lol.setattribute ("Checked", "checked");
Element adds a checked tag, then the lol.checked value is True
<input type= "checkbox" checked= "checked" value= "LOL"/>lol
In fact, checked tag, the existence of the application, the following wording can be implemented by default selected
<input type= "checkbox" checked value= "LOL"/>lol
Selected by default when the browser parses text.
The above JS table cell element checked, radio selected several methods (detailed) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.