I understand that I can use jQuery (how to get multiple checkbox value using jquery) to get checkbox values when there are multiple, but my checkbox inputs are inside an html form, so those jQuery solutions aren't working because none of them get the checkbox values from within a form.
I try to extract the values from the form, but it just creates a weird radio nodelist that seems to count the number of times the name of the checkboxes appears in the doc rather than the values.
function validateForm() {
var checks = document.forms["TestForm"]["ParticipantSelection[]"];
alert(checks);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<form name="TestForm" action="Video1.php" method="post" onsubmit="return validateForm()">
<table>
<tr>
<th><img name="<?php echo $valueindicator[0];?>" src="<?php echo $all_four_images[0];?>" height="100">
</th>
<th><img name="<?php echo $valueindicator[1];?>" src="<?php echo $all_four_images[1];?>" height="100">
</th>
<th><img name="<?php echo $valueindicator[2];?>" src="<?php echo $all_four_images[2];?>" height="100">
</th>
</tr>
<tr>
<th> <input type="checkbox" name="ParticipantSelection[]" value="image1">
</th>
<th><input type="checkbox" name="ParticipantSelection[]" value="image2">
</th>
<th><input type="checkbox" name="ParticipantSelection[]" value="image3">
</th>
</tr>
</table>
<input type="hidden" name="AnswerCondition" value="BrowserCheckAnswer">
<button type="submit">Continue</button>
</form>
But I have no idea how to get the js to get the value of whats inside the form inputs instead of counting something else, and no idea how to access the values of the checked boxes
.valueon something if you want its value. Similar to how you diddocument.forms.