Hello list, I am relatively new at JS and also JQuery and am having some problems with configuring the stock datepicker object.
Here is my class structure:
var accounting =
{
init: function()
{
var invDate = $("#invDate");
for(var i = 0, ii = invDate.length; i < ii; i++){
// an existing date in an input element, format like 'mm-dd-yy'
idte = document.getElementById('invDate').value;
invDate.datepicker();
invDate.datepicker({
dateFormat:"mm-dd-yy",
minDate: -20,
maxDate: "+1M +10D",
showAnim: "fadeIn",
altField: "#actualDate",
changeMonth: true,
numberOfMonths: 3,
showButtonPanel: true
});
[B]$(invDate).DatePicker("setDate", idte);[/B] // fails here
$(invDate).bind("change", accounting.doInvDate);
}
},
doInvDate: function(event){
// never gets here
var dte = $(this).DatePicker("getDate");
alert('INV Date has changed, returned value is: '+ dte);
}
}
accounting.init();
This will create the date picker object so that when the input cell is selected, the datepicker object opens, but I cannot set the date. Also, I would like to get the 3 months showing when the cell is selected, but that never happens either.
Any suggestions?