lundi 7 novembre 2016

jQuery check if Checkboxes are on page

I have a form that loads via ajax. Depending on the parameters sent to fetch the form, the form may have no checkboxes or it may have one or more check boxes.

I want to check if a checkbox is present on the page and if yes prompt the user to select one during validation if not selected.

If present, the checkboxes have the same class and a different ID.

<input type="checkbox" name="associatedClass" value="$associatedClsNumVal" class="getAssociatedClass" id="$associatedClsNumVal" />

What is the best approach? Can jquery "sense" if there are checkboxes on a page/in a form?

Thanks.




Aucun commentaire:

Enregistrer un commentaire