Hi i'm a rookie in html and been struggling in this 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 just want to know how to set the second input minimum date from the first input selected value? i've already searched and i just can't get the right answer...
PHP is server-side script that only runs on the server (not on the client). For a more detailed explanation of client-side vs server-side scripting please view this
To accomplish what you want, you would use client-side script like JavaScript you can easily achieve this.
Below is jQuery that will update the second field whenever the first field is changed.
jQuery
$("input[name='from']").change(function() {
$("input[name='to']").val($(this).val());
})
Make sure to include jQuery so that the above loads: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.