我似乎一辈子都无法让它正常工作。
执行 jQuery 时,它工作正常,并且第一次设置 var(文本)就好了。
然后,如果再次调用它,它会保留原始文本并且不会改变,当然,除非我要刷新网页。
如何修改代码,以便将 var 文本设置为应有的值?
var sdate, text
//....1)
$(document).on('keypress', function (e){ if(e.which === 13 && $('#dd').dialog('isOpen') === true) { $('.ui-state-active').click(); } });
$('#dd').dialog({ autoOpen: true, modal: true, overlay: { opacity: 1.0, background: 'black' }, title: "SELECT A NEW DUE DATE", height: 235, width: 235, draggable: false, resizable: false});
$('#d1').datepicker({
onSelect: function() {
sdate = $(this).val();
text = 'THIS IS THE ORIGINAL TEXT WHEN A DATE IS SELECTED IN THE DATEPICKER'
$("#dd").dialog("close");
}//end of onSelect: function() {
});//end of datepicker
//....2)
$(document).on('keypress', function (e){ if(e.which === 13 && $('#dd').dialog('isOpen') === true) { $('.ui-state-active').click(); } });
$('#dd').dialog({ autoOpen: true, modal: true, overlay: { opacity: 1.0, background: 'black' }, title: "SELECT APPROVAL DATE", height: 235, width: 235, draggable: false, resizable: false});
$('#d1').datepicker({
onSelect: function() {
sdate = $(this).val();
text = 'THE TEXT NEVER CHANGES FOR SOME ODD REASON AND CANT SEEM TO FIGURE OUT WHY'
$("#dd").dialog("close");
}//end of onSelect: function() {
});//end of datepicker