I need to see if any checkboxes within a range in a fieldset are checked
<fieldset id="issues">
<input name="A" id="issue_0" type="checkbox" value="A" /> <--- this one
<input name="B" id="issue_1" type="checkbox" value="B" />
<input name="C" id="issue_2" type="checkbox" value="C" />
<input name="D" id="issue_3" type="checkbox" value="D" />
<input name="E" id="issue_4" type="checkbox" value="E" />
</fieldset>
The field set is #issues, this works fine to see if any of them are checked
if( $('#issues input[type="checkbox"]').is(':checked') ){
console.log("One of them is checked");
}
But I want to see if a specific checkbox by index is checked, ie if the first one is checked. I tried this...
if( $('#issues input[type="checkbox"][0]').is(':checked') ){
console.log("Item one is checked");
}
but it doesn't work
How do I target a specific checkbox by index within a fieldset?