JQuery saves the value of the selected checkbox check box to the array, jquerycheckbox
JQuery saves the value of the selected checkbox check box to an array:
In practice, you may need to select the value of the check box to store it in an array for subsequent operations. The following is a piece of code that can implement this function.
The Code is as follows:
<! DOCTYPE html>
The above code implements our requirements. The implementation principle is also very simple, that is, to obtain the checkbox check box jQuery object set, and then traverse each check box element in the set through the each () function, then, determine whether the element is selected. If it is selected, it is saved to the array.
Related reading:
1. For details about the each () function, refer to the each () method section of jQuery.
2. $ ("input [name = items]") refer to [attribute = value] selector in jQuery.
3. For more information about the push () function, see the push () method section of the Array object in javascript.
4. For the join () function, see the join () method section of the Array object in javascript.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 12614.
For more information, see: http://www.softwhy.com/jquery/