Home >Web Front-end >JS Tutorial >JQUERY checkbox CHECKBOX select all, cancel all selection_jquery

JQUERY checkbox CHECKBOX select all, cancel all selection_jquery

WBOY
WBOYOriginal
2016-05-16 19:01:371076browse

Copy code The code is as follows:



value2
value3




A simpler one:

Copy code The code is as follows:

$("#checkall"). click(
function(){
if(this.checked){
$("input[name='checkname']").each(function(){this.checked=true;}) ;
}else{
$("input[name='checkname']").each(function(){this.checked=false;});
}
}
);
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