<td id="optrep0"> <input type="checkbox" value="1" class="warna" id="warna" name="warna[]"> <input type="checkbox" value="2" class="warna" id="warna" name="warna[]"> </td> <td id="optrep1"> <input type="checkbox" value="1" class="warna" id="warna" name="warna[]"> <input type="checkbox" value="2" class="warna" id="warna" name="warna[]"> </td> <td id="optrep2"> <input type="checkbox" value="1" class="warna" id="warna" name="warna[]"> <input type="checkbox" value="2" class="warna" id="warna" name="warna[]"> </td>
I need to find the checked value of the specified div with id s: optrep0 , optrep1 , optrep2 above, I tried using
var optrep0= jQuery(':checkbox:checked').map(function () { return this.value; }).get();
And send the optrep0 variable to the server, but it will send each checked value. So, I want to send only the specified div just for the variable, I also tried
var optrep0= jQuery('#optrep0>#warna:checkbox:checked').map(function () { return this.value; }).get();
PS: the subdirectory name on td id cannot be changed as is, I only need a javascript example, how to solve this case, thanks: D
javascript jquery html css php
Reids Meke Meke
source share