php - set the input type = date min from another input type = date -
hi i'm rookie in html , been struggling in inputs,
<label>check-in date : </label> <input id ="date1" type="date" name="from" min=<?php echo date('y-m-d', strtotime("+3 days"));;?>> <label>check-out date : </label> <input id = "date2" type="date" name="to">
i want know how set second input minimum date first input selected value? i've searched , can't right answer...
php server-side script runs on server (not on client). more detailed explanation of client-side vs server-side scripting please view this
to accomplish want, use client-side script javascript can achieve this.
below jquery update second field whenever first field changed.
jquery
$("input[name='from']").change(function() { $("input[name='to']").val($(this).val()); })
make sure include jquery above loads: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
Comments
Post a Comment