Simply declare it outside the function:
var currentDate; //declare outside function
jQuery("#datepicker").datepicker({
onSelect: function(value) {
alert('The chosen date is ' + value);
currentDate= Math.round(Date.parse(value)/ 1000);
}
});
1
solved JQuery- using a variable outside of the scope of the function