我正在尝试在 jquery 中设置对话框按钮的文本。我有 2 个变量,其值会动态变化。这些值应设置为按钮文本。我已经编写了以下代码。
var monthNames = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
var today = new Date();
var month = monthNames[today.getMonth()];
var nextMonth = monthNames[today.getMonth()+1];
$( ".selector" ).dialog({ buttons: [
{
text: month,
click: function() { $(this).dialog("close"); }
},
{
text: nextMonth,
click: function() { $(this).dialog('close'); }
}
] });
});
但是表单对话框没有加载。请帮助我提出您的宝贵建议。