Reputation: 456
I am using asp.net code where datepicker is used to enter date. I want some code so that previous date cannot be selected and entered by the datepicker. How can I put the restriction.
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
please tell me any asp.net code
Upvotes: 0
Views: 1300
Reputation: 456
$(function() {
$( "#datepicker" ).datepicker({ minDate: -0, maxDate: "+1M +10D" });
});
Upvotes: 0
Reputation: 8726
try this
minimum date can select from last 20 days
$(function() {
$( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });
});
Upvotes: 2