Share the next JavaScript get checkbox check box to get the option selected.
There are countless instances of the JavaScript get checkbox check box.
JS implementation:
varform = document.getElementById ("Form2");varfield = form.elements["Test2"];varoption =dining.getselectedoption (form, field);varMessage = ""; for(vari = 0, len = option.length; i < Len; i++) {Message+ = "SELECT ID:" + option[i].id + "\nselected Name:" + option[i].name + "\nselected value:" + option[i].value + "\ n";} alert (message);/*Gets the selected option*/getselectedoption:function(Selectform, Selectionfield) {varresult = [];varoption =NULL; for(vari = 0; i < selectionfield.length; i++) {option=Selectionfield[i];if(option.checked) {result.push (option);} www.jbxue.com}returnresult;}<form id= ' Form2 ' ><label> sort: </label><input id= ' aaaaa ' type= ' checkbox ' name= ' test2 ' value= ' 1 ' ><label for= ' AAAAA ' > Month sales </label><input id= ' bbbbb ' type= ' checkbox ' name= ' test2 ' value= ' 2 ' ><label for= ' bbbbb ' > Rated </label><input id= ' ccccc ' type= ' checkbox ' name= ' test2 ' value= ' 3 ' ><label for= ' CCCCC ' > offers </label> <br style= ' clear:both ' ><label> categories: </label><input id= ' ddddd ' type= ' checkbox ' name= ' test2 ' value= ' 4 ' ><label for= ' DDDDD ' > Business package </label><input id= ' eeeee ' type= ' checkbox ' name= ' test2 ' value= ' 5 ' ><label for= ' eeeee ' > Cold dish </label><input id= ' fffff ' type= ' checkbox ' name= ' test2 ' value= ' 6 ' ></form> ',