I am trying to attempt to call back a value from a function, however, the call back is always undefined because the jQuery Date Picker never has a chance to set the var sdate, thus alerts me that it is undefined. I realy need your help and can't seem to get passed this problem.
var sdate
function test() {
select_date()
alert(sdate)
}
function select_date() {
$('#dd').dialog({
autoOpen: true,
modal: true,
overlay: {
opacity: 0.5,
background: 'black'
},
title: "title",
height: 265,
width: 235,
draggable: false,
resizable: false
}); //end of dialog
var x
$('#d1').datepicker({
onSelect: function() {
sdate = $(this).val();
$("#dd").dialog("close");
}
});
return sdate
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…