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

How to select all in CheckBox? _JavaScript

WBOY
Release: 2016-05-16 19:29:19
Original
1014 people have browsed it

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:


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template