vendredi 1 avril 2016

(php/jquery) hide and show checkboxes according to another checked checkbox value

i have a table in my database like this:

------------------------------
| ID_1         | ID_2        |
------------------------------
| A            | 1           |
| A            | 2           |
| A            | 3           |
| B            | 1           |
| B            | 2           |
| B            | 5           |
| C            | 1           |
| C            | 4           |
| C            | 3           |
------------------------------

and i have some checkboxes for ID_1 like this

<input id="ID_1" type="checkbox" name="checkbox" value="A">
<input id="ID_1" type="checkbox" name="checkbox" value="B">
<input id="ID_1" type="checkbox" name="checkbox" value="C">

i'm trying to do that each time i checked the ID_1 checkbox, the ID_2 checkbox will show, depends on ID_1 checkbox i checked according to the table above. so if i checked two checkboxes

<input id="ID_1" type="checkbox" name="checkbox" value="A" checked>
<input id="ID_1" type="checkbox" name="checkbox" value="B" checked>
<input id="ID_1" type="checkbox" name="checkbox" value="C">

it'll show like this:

<input id="ID_2" type="checkbox" name="checkbox" value="1">
<input id="ID_2" type="checkbox" name="checkbox" value="2">
<input id="ID_2" type="checkbox" name="checkbox" value="3">
<input id="ID_2" type="checkbox" name="checkbox" value="5">

is that possible using jquery? i need your help please




Aucun commentaire:

Enregistrer un commentaire