mercredi 24 février 2016

jQuery if checkbox "A" is checked from list 1, check "A" on list 2

I have a main list of checkboxes:

<div id="main_list">
<input name="main_list[]" class="main-checkbox" value="Austin" checked="" type="checkbox">
<input name="main_list[]" class="main-checkbox" value="San Antonio" checked="" type="checkbox">
<input name="main_list[]" class="main-checkbox" value="El Paso" checked="" type="checkbox">
</div>    

I would like to match the two lists, for example if "Austin" is checked on main list, check on single list.

<div id="single_list">
<input name="checkbox_list[]" class="list-checkbox" value="Austin" type="checkbox">
<input name="checkbox_list[]" class="list-checkbox" value="Houston" type="checkbox">
<input name="checkbox_list[]" class="list-checkbox" value="Dallas" type="checkbox">
</div>

How can I accomplish it? Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire