i have followed
jQuery UI Datepicker - Display
Use onSelect
method which is called when date is selected and gets date as text
$(function() {
$( "#datepicker" ).datepicker({
onSelect: function(date) {
alert(date);
}
});
});
try this..
var selecteddate= $( "#datepicker" ).datepicker( "getDate" );
alert(selecteddate);
here is the documentation
updated
use onselect
, if you need it on click.
$( "#datepicker" ).datepicker({
onSelect: function(date) {
alert(date);
//do your processing here
}
});
onSelect
$("#expirationDate").datepicker({
buttonImage: '../Images/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
showOn: 'both',
onSelect: function () {
getValidTillDateValue(this);
}
});
function getValidTillDateValue(ele) {
return $(ele).val();
}
If you want the Date value later say on form submit you want to check the value
valuePublishDate = $("#customerPublishingDate").datepicker("getDate");
You can use the below code
$("#datepicker").datepicker("getDate");
Thanks,