I have an array of input boxes like so.
<form>
9 <input type="checkbox" name="date[]" value="9">
10 <input type="checkbox" name="date[]" value="10">
11 <input type="checkbox" name="date[]" value="11">
</form>
I need the values stored in the date array, to pass it to an ajax call.
I've tried
console.log($("input[name^=date]").val());
But this only outputs 9. I could always check if the individual elements are checked and then get their values, make an array and pass it to the ajax call, but is there a way to do this directly?
EDIT : Why does the console.log($("input[name^=date]").val()); output 9 only?