How do I take only the selected checkboxes and store them into an array when the button is clicked?
This is the code I currently have. It is not finished because I'm not sure what to do as I am new to jQuery
$(document).ready(function() {
// code
var configs = [];
var testPages = [];
$("button").click(function(){
$(".testpages")....
$(".configs").....
})
});
Html:
<form>
<div class="test">
<input id="1" type="checkbox" value="val1">a<br>
<input id="2" type="checkbox" value="val2">b<br>
<input id="3" type="checkbox" value="val3">c<br>
</div>
<div class="config">
<input id="10" type="checkbox" value="val10">a1<br>
<input id="11" type="checkbox" value="val11">a2<br>
<input id="12" type="checkbox" value="val12">a3<br>
</div>
</form>
<button type="button">submit</button>