How can I select all checkboxes from a form using pure JavaScript (without JS frameworks)?
javascript
Solution
In your case:
for (i = 1; i<3; i++) {
document.getElementById('lang_'+i).checked = true;
}
Problem
I have question, how write function to select all chceckbox on form, when all checkbox Id start from some const. string, using pure java script (without jquery and other frameworks) ? I know how do it using each function from JQuery, but I dont have any idea hwo do it in pure JS.My form ex. ``` <form id="myId" name="myForm"> <input type="checkbox" id="lang_1" value="de"/> DE <input type="checkbox" id="lang_2" value="us"/> US <input type="checkbox" id="lang_3" value="ru"/> RU <input type="button" onclick="Select();" value="Select all"/> </form> ```