I am trying to set the text of a button of a Dialog in jquery. I have 2 variables whose value will change dynamically. These values should be set to Button text. I have written the following code.
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'); }
}
] });
});
But Form Dialog is not loading. Pls help me with your valuable suggestions.
$( ".selector" )