I am attempting to create a dynamic calendar View where I would like different actions on a page to change what day the calendar popup loads to using the .datepicker plugin. I am fairly new to jquery and was hoping that someone could provide any ideas to how I could change what day the datepicker calendar loads to. I attempted to change the "default Date:" option but nothing seemed to affect the default date.
var changedDate= '@Model.DateTime.ToShortDateString()'; // is MM/DD/YYYY format
$(document).ready(function() {
$("#dP").datepicker({
onSelect: function(dateText, inst) {
selectedDate = $("input#dP").val();
window.location = "Day?date=" + selectedDate;
},
minDate: 0,
defaultDate: changedDate
});
$("#idDatePicker").click(function() {
$("#dP").datepicker("show");
});
});
This is the HTML I'm calling.
<a class="month ui-datepicker-trigger" id ="idDatePicker"> </a>
<input type="text" style="visibility:hidden" id="dP" name="dP" value=""/>