Home > Web Front-end > JS Tutorial > jquery array storage checkbox all selected value sample code_jquery

jquery array storage checkbox all selected value sample code_jquery

WBOY
Release: 2016-05-16 17:08:02
Original
1021 people have browsed it
Copy code The code is as follows:

Select all/unselect all
1
2
3
4


<script> <br>$("#chekcAll").click(function(){ <br>if(this.checked){ <br>$("input[name =items]").attr("checked","checked"); <br>} <br>else{ <br>$("input[name=items]").attr("checked",null); <br>} <br>}) <br>function show(){ <br>var strIds=new Array();//Declare an array to store ids<br>$("input[name=items]") .each(function (i,d){ <br>if (d.checked) { <br>strIds.push(d.value); <br>} <br>}) <br>if(strIds.length< 1) <BR>alert("You have no selected items!"); <BR>else{ <BR>var ids=strIds.join(","); <BR>alert("The strings you selected are:" ids); <BR>} <br><br><BR>} <br><br></script>
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