I am using the altfield and altformat options on the jquery ui datepicker to display a friendly date to the user, while having the date formatted for the database in a hidden field. The only thing is, I don't want the date shown to the user in an input box (visually it suggests they can type in it), I just want it shown as text. I know I could style an input box so it doesn't look like it is one, but I'd rather just use a div and update the text. However, it only seems to work with an input field, if you set it to a div id, it does nothing.
Has anyone overcome this issue?
I've gotten it to display in a div using this in the onSelect:
onSelect: function(dateText, inst) {
//formatDate Requires a new date object to work
var myDate = new Date(dateText);
//Set a new var with different format to use
var newFormat = $.datepicker.formatDate("DD, d MM, yy", myDate);
//Choose the div you want to replace
$("#yourselctorhere").html(newFormat);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With