Home > Web Front-end > JS Tutorial > body text

jquery, js operation checkbox all selection and inverse selection_javascript skills

WBOY
Release: 2016-05-16 16:55:44
Original
1051 people have browsed it

Operate the checkbox, select all and invert the selection

Copy the code The code is as follows:

//Select all
function checkAll() {
$('input[name="TheID"]').attr("checked", "checked");
}
//Inverse selection
function uncheckAll( ) {
$('input[name="TheID"]').each(function() {
this.checked = !this.checked;
})
}
/ /Get the selected item
function getCheck(){
var check = $('input[name="TheID"]:checkbox').map(function() {
return $(this). val();
}).get().join(',');
return check;
}
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