This question has already been answered:
In the form of a lot of checkboxes, and there is a "clear" button, which should remove the checkmarks from all checkboxes. How to do it?
This question has already been answered:
In the form of a lot of checkboxes, and there is a "clear" button, which should remove the checkmarks from all checkboxes. How to do it?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
NodeList.prototype.forEach = Array.prototype.forEach; document.getElementById("clear").addEventListener("click", function(e) { var formBlock = document.getElementById("formId"); var inputArr = formBlock.querySelectorAll("input[type=checkbox]"); inputArr.forEach(function(el) { el.checked = false; }); });
<form id="formId" > <input type="checkbox" name="option1" value="a1" checked>1 <Br> <input type="checkbox" name="option2" value="a2" checked>2 <Br> <input type="checkbox" name="option3" value="a3" checked>3 <Br> <input type="checkbox" name="option4" value="a4">4 <Br> <input type="checkbox" name="option5" value="a5">5 </form> <div id="clear">Очистить</div>
The answer to such a simple question is faster to find yourself http://javascript.ru/forum/jquery/52170-snyat-galochki-so-vsekh-chekboksov.html
cycle on all the necessary elements
$('[name^="access"]').prop({'checked': false})
Source: https://ru.stackoverflow.com/questions/554575/
All Articles