1. Set checkbox check:
Select multiple marquee
checkbox=$ ("#agentinfo input[name= ' veri[]");
Loop the value
Checkbox.each (function () {for
(var j=0;j<data.veri.length;j++) {
////To determine if the current value is in an array
. (this). val () = = Data.veri[j]) {
$ (this). attr (' checked ', ' checked ');//Check
}}
);
2. Modify CheckBox selection by clicking
3. Get the selected value in the checkbox
Get multiple marquee
checkbox=$ ("#agentinfo input[name= ' veri[]");
Defines a string concatenation of the resulting values, in order to facilitate the transmission of
var veri_str = ';
Checkbox.each (function () {
//Decide whether to be selected, here is the reason I want to write this blog, starting with the $ (this). attr (' checked ') ==true judge, but dead
or Alive/ is to get the value of the previous jquery assignment, the page will get rid of, depressed not, the final fairy help me to fix.
//To use $ (this). Is (': checked '), do not understand why!
if ($ (this). are (': Checked '))
veri_str+=$ (This). Val () + ', ';//assemble String
});
The above discussion of jquery set up and get checkbox selected is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.