The code below is a cut down version of the page, but you see that it will iterate through a list and produce a checkbox for each item in the list.
What I want to know:
<s:form action="manageQuestions" > <s:iterator value="questions" id="currentQuestion"> <s:checkbox name="questionCheck" id="ch-%{id}" value="selected" fieldValue="%{id}"/> </s:iterator> </s:form>
I'm such a jQuery dunce that I know that I need to put:
<script>
</script>
there at the end but that's all I know. I don't know if I need to put:
$(document).ready(function() {
//something here
}
or if I don't need the document ready etc. at all.
Try this: http://jsbin.com/AfEriqe/1/edit
$(document).ready(function() {
var checkboxes = $('input[type=checkbox]');
$(checkboxes).on('change', function() {
console.log('checkbox changed');
if($(checkboxes).is(':checked')) {
console.log('at least one checked');
}
});
});