I have a form with 2 text fields that trigger a jquery date picker.
I want to set empty values to both text field by unchecking a checkbox that is in the same form.
The text fields are:
<?php
if ($_GET["arrival"]== "")
echo '
<label for="arrival">Arrival </label>
<input type="text" name="arrival" class="w8em format-d-m-y highlight-days-67 range-low-today" id="arrival" value="Select Date"/> ';
else
echo '
<label for="arrival">Arrival </label>
<input type="text" name="arrival" class="w8em format-d-m-y highlight-days-67 range-low-today" id="arrival" value="' . $_GET["arrival"] . '"/> ';
?>
<?php
if ($_GET["departure"]== "")
echo '
<label for="departure">Departure </label>
<input type="text" name="departure" class="w8em format-d-m-y highlight-days-67 range-low-today" id="departure" value="Select Date"/> ';
else
echo '
<label for="departure">Departure </label>
<input type="text" name="departure" class="w8em format-d-m-y highlight-days-67 range-low-today" id="departure" value="' . $_GET["departure"] . '"/> ';
?>
The checkbox is:
<input name="avail" type="checkbox" id="avail"
<?php if ($_GET["avail"]== "1") echo "checked=\"checked\""; ?>
value="1" />
I want by deselecting it to set empty values to text fields.
You can use jquery for make it working.
checkbox
onclick eventyou can set empty value for textfield.Add onclick event on checkbox