Datepicker min. value not changing

Hi.

I have simple 2 datepickers, i am trying to change the min. date value of second datepicker based on the first one but its not working. My code is following:

<form method="post" action="search.php">
<input required type="date" id="strdate" name="strdate" />
<input required type="date" id="enddate" name="enddate" />
<input type="submit" name="btnSearch" value="Check" />
</form>

<script>
$('#strdate').datepicker({
	onSelect: function(dateStr) {
		var min = $(this).datepicker('getDate') || new Date(); 
		
		min.setDate(min.getDate()+2); //add two days
		$('#enddate').datepicker('option', {minDate: min});
	}
});
</script>

What’s wrong with it ?

Thanks.

http://jsfiddle.net/f4s46bvq/1/ i done it for you plz see that

Seems to be working for me!

It’s work fine sir

Sorry, I thought you were the original poster posting a fiddle of the problem :smile:

Yes your version works fine:)

Thank you so much sir

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.