Home >Web Front-end >JS Tutorial >How to select all in CheckBox? _JavaScript

How to select all in CheckBox? _JavaScript

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 19:29:191022browse

There are many CheckBoxes in a form. How can I select one and select all of them?
-------------------------------------------------- ----------------

function selectAll(checkBoxName){
var elms = document.getElementsByName(checkBoxName);
if (elms.length< 1) return; type=="checkbox")
allChecked &= elms[i].checked;
for (var i=0;i if (elms[i].type=="checkbox"){
                                                                                                                                                                                       [i].checked = !allChecked;
                                                                                                                                                          -------------------------------------------------- ----



Select all< input type=checkbox value="Check All" onclick="mm(this)">











Select all:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn