I am using JQueryUI datepicker, when clicking on the calendar image for the first time the calendar is not shown. However, when a postback occurs then the calender is displayed.
I am using the below is the code snippet to initialize datepicker:
$(function() {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$("#ReportDate").datepicker({
showOn: "both",
buttonImage: "calendar.png",
buttonImageOnly: true,
buttonText: "Select date",
maxDate: new Date(currentYear, currentMonth, currentDate)
});
});
.ui-datepicker {
font-size: 8pt !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker</title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div class="demo">
<b>Date:</b> <input type="text" id="ReportDate" />
</div>
</form>
</body>
</html>
Can any one please help. I am really stuck from long time.
I think mistake in your script tag
i have update your code Here
check this link and let me know it's working or not.