vendredi 29 septembre 2017

How to check off checkboxes based on array values

I really need your help and I couldn't seem to find a similar solution out there that would provide the support I needed for what I am trying to accomplish here.

How can I programmatically check off the following check boxes based on their values in an array.

var arr = ['recurr_date2','recurr_date4']

I'd like to check the checkbox whose value is recurr_date2 and recurr_date4

Here is the HTML markup:

<input name="recurr_target" value="recurr_date2" type="checkbox">
<input name="recurr_target" value="recurr_date3" type="checkbox">
<input name="recurr_target" value="recurr_date4" type="checkbox">

I am fine with an anwer also using jQuery




Aucun commentaire:

Enregistrer un commentaire