vendredi 16 septembre 2016

jQuery if one of three checkboxs is checked

I have these 3 checkboxes:

<input type="checkbox" name="ProjectID[]" value="5896" style="float: left; width: 1.5%;">1<br>
<input type="checkbox" name="ProjectID[]" value="5898" style="float: left; width: 1.5%;">2<br>
<input type="checkbox" name="ProjectID[]" value="5897" style="float: left; width: 1.5%;">3<br>

and I am trying to use jquery to validate that at least 1 was selected.

I have been trying just to return true or false in a console log to make sure I am getting the correct value (true or false)

console.log($("input[type='checkbox'][name='ProjectID[]']").checked);

but this returns undefined.




Aucun commentaire:

Enregistrer un commentaire