vendredi 9 juin 2017

Set a specific value in input field when unchecked

We have table input to get morning & evening timing for user.

if user has to enter morning time, he has to check the checkbox. if it's unchecked it's blurred and he cannot fill value in it.

when it's unchecked, default value for time1 & time2 should be "00:00".

Same goes for evening timing.

Please suggest how to do so.

<table border="1"">
                        <tr>
                                <th colspan="3">User Timing</th>
                        </tr>
                        <tr>
                                <td>Morning</td>
                                <td><input name="morning" type="checkbox" id="set_val1" value="1"></td>
                                <td><input type="time" name="time1" min="" class="timing" value="<?php echo $time1; ?>" placeholder="" required>
                                                to
                                        <input type="time" name="time2" min="" class="timing" value="<?php echo $time2; ?>" placeholder="" required>
                                </td>
                        </tr>
                          <tr>
                                <td>Evening</td>
                                <td><input name="evening" type="checkbox" id="set_val2" value="00:00"></td>
                                <td><input type="time" name="time3" min="" class="timing" value="<?php echo $time3; ?>" placeholder="" required>
                                                to
                                        <input type="time" name="time4" min="" class="timing" value="<?php echo $time4; ?>" placeholder=""required></td>
                          </tr>
          
                        </table>



Aucun commentaire:

Enregistrer un commentaire