I have two input fields, one with a start date and one with the finish date. How can i automaticaly setup the finish date as start date + 1 day when i input a date in the first field?
My code is like this:
<form>
Start: <input type="text" name="date_start" id="datepicker0">
Stop: <input type="text" name="date_stop" id="datepicker1">
</form>
Demo - http://jsfiddle.net/ffwr2/1/
$('#date1').datepicker();
$('#date2').datepicker();
$('#date1').change(function(){
var date1 = $('#date1').datepicker('getDate');
var date = new Date( Date.parse( date1 ) );
date.setDate( date.getDate() + 1 );
var newDate = date.toDateString();
newDate = new Date( Date.parse( newDate ) );
$('#date2').datepicker('setDate', newDate );
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With