We're using jquery UI 1.8.23 at my workplace.
How can I capture the date clicked in datepicker, so I can format the current date into a datestamp and pass that value into a hidden form field?
Here's some code I've tried to get working:
$('.ui-state-default').live('click', function(){
console.log('date clicked');
var currentdate = $(this).text();
var d = currentdate;
var m = monthFormat($('.ui-datepicker-month').text());
var y = $('.ui-datepicker-year').text();
$('a.ui-state-default').removeClass('ui-state-highlight');
$(this).addClass('ui-state-highlight');
if (currentdate.length < 2) {
d = "0" + currentdate;
}
var datestamp = y + "-" + m + "-" + d;
console.log(datestamp);
$('#dateHidden').val(datestamp);
});
Thanks for looking at my code I appreciate any help you guys can offer.