I need to iterate through the all the check boxes within my SPFieldMultiChoice
and check whether at least any one of the checkboxes are checked and if not checked, I need to return false
.
I have this field created in my newform.aspx
in my presaveaction
call.
I tried with the below code , but it didn't work:
if ($('input:checkbox:checked').length == 0)
{
alert('Enter at least one checkbox.');
}
else
{
}
Also below code also doesn't work.
var count = $('#checkboxes input:checked').length;
I was trying to get the ID of the SPFieldMultiChoice
field but,in the
F12 Dev Console
, am unable to see an ID for this control specifically.It's splitted into all the checkbox IDs, instead