Home > ASP.Net, Jquery > End Date should be greater than Start Date using jQuery Date Picker

End Date should be greater than Start Date using jQuery Date Picker


Hi all,

try this example to allow user to select date from JQuery Date Picker where End date should be greater than start date and also greater than today date


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <title></title>
 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/base/jquery-ui.css" type="text/css" media="all" />
 <link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>
 <script type="text/javascript">
 $(document).ready(function () {
 $("#txtFromDate").datepicker({
 minDate: 0,
 maxDate: "+60D",
 numberOfMonths: 2,
 onSelect: function (selected) {
 $("#txtToDate").datepicker("option", "minDate", selected)
 }
 });
 $("#txtToDate").datepicker({
 minDate: 0,
 maxDate: "+60D",
 numberOfMonths: 2,
 onSelect: function (selected) {
 $("#txtFromDate").datepicker("option", "maxDate", selected)
 }
 });
 });
 </script>
</head>
<body>
 <form id="form1" runat="server">
 <div>
 <label for="StartDate">
 Start Date:
 <input type="text" name="txtFromDate" id="txtFromDate" value="" class="frmitem datepick" readonly="true" />
 </label>
 <label for="EndDate">
 End Date:
 <input type="text" name="txtToDate" id="txtToDate" value="" class="frmitem datepick" readonly="true" />
 </label>
 </div>
 </form>
</body>
</html>

Hope this helps

Good Luck.

Advertisements
Categories: ASP.Net, Jquery
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: