How can I get the values of jquery datepicker after the user click the button. I found this How to get date, month, year in jQuery UI datepicker? but I need it to get done when the user click the button, not on the event when the user selected a date.
CODE:
//FOR DATE PICKER
$(function () {
$('.dateRange').datepicker({
dateFormat: 'mm-dd-yy',
changeMonth: true,
changeYear: true,
yearRange: "1940: +nn"
});
});
//When the button is click get the values of selected month,date,year
function testDateRange() {
var date = $(this).datepicker('getDate');
alert(date);
}
I tried this
var x = $('#MainContent_startDate').val();
it outputs e.g. 2/23/2016 but what I needed output is
Month: 2
Date: 23
Year: 2016