There are two TextBox fields on a page. The requirement is that when a user selects a date from the first TextBox, the second TextBox should automatically display the next day's date (disable any previous dates). For example: If the user selects 2020-12-29 in the first TextBox, the minimum allowable date for the second TextBox should be 2020-12-30.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var today = new Date();
var month = ('0' + (today.getMonth() + 1)).slice(-2);
var day = ('0' + today.getDate()).slice(-2);
var year = today.getFullYear();
var date = year + '-' + month + '-' + day;
$('[id*=txt1]').attr('min', date);
});
</script>
<asp:TextBox ID="txt1" runat="server" TextMode="Date"></asp:TextBox>
<asp:TextBox ID="txt2" runat="server" TextMode="Date"></asp:TextBox>
I'm struggling to implement the functionality for the second TextBox using JavaScript alone. However, I am open to suggestions for implementing it using C# as well.