dimanche 1 octobre 2017

Jquery - Enable/Disable randomly generated Text & Radio Inputs with Checkbox

I'm having a PHP do while loop for generating Text, Radio and Checkbox input fields. The text and radio fields are disabled by default and I want to enable them as I check the corresponding Checkbox. I have assigned random IDs and tried many jquery solutions but still having problem. Plz help me out with this.

CODE

<?php
$query = "SELECT * FROM `test` ";
$result = mysql_query($query);
$count = 0;
  do{
  $row = mysql_fetch_array($result);
  if($row){
    $id = $row['id'];
    $name = $row['name'];
?>

    <tr>
        <td><?php echo $name; ?></td>
        <td><input type="text" id="txt_<?php echo $count; ?>" class="txt form-control" name="txt" style="width:200px;" disabled /></td>
        <td><input type="radio" id="radio_<?php echo $count; ?>" class="rdo" name="rdo<?php echo $count; ?>" value="yes" disabled /></td>
        <td><input type="radio" id="radio_<?php echo $count; ?>" class="rdo" name="rdo<?php echo $count; ?>" value="no" disabled /></td>
        <td><input type="checkbox" id="check_<?php echo $count; ?>" class="checks" name="check" /></td>
    </tr>

<?php
    $count = $count + 1;
    }
}
while($row);
?>




Aucun commentaire:

Enregistrer un commentaire