JQuery API:
Each (callback): Executes a function with each matching element as the context.
: Checked: Matches all selected selected elements (Checkboxes, radio boxes, etc., excluding option in select)
ls|
//js get check box valuevarobj = Document.getelementsbyname ("Interest");//selects all objects name= "Interest", returns the arrayvars="';//If you define VAR s in this way, the variable s will be assigned a null value by default for(varI=0; i<obj.length;i++){ if(Obj[i].checked)//after the object array is taken, we loop to detect whether it is selectedS+=obj[i].value+',';//If selected, adds value to the variable s}
Jquery:
// jquery Gets the check box value var chk_value =[]; // define an array $ (' input[name= ' interest "]:checked '). each (function() { // Iterate through each check box named interest, where the execution function selected Chk_value.push ($ (this).Val ()); Add the selected value to the array chk_value });
jquery Gets the value of the check box checkbox