Setting Jquery diloag button text does not work as expected
I am trying to use jquery dialo开发者_JAVA百科g, but the following code shows 0, 1 on the button text instead of the text that is specified. I need to use this syntax compared to the other one mentioned in jQuery docs. Can any one help me with the flowing code.
$( ".selector" ).dialog({ buttons: [
{
text: "Ok",
click: function() { $(this).dialog("close"); }
}
] });
It works in a fiddle exactly as you have it:
http://jsfiddle.net/jensbits/bGuLj/
Maybe something else is conflicting??
You have options in your code that do not exist for the jquery dialog: autoShow and beforeClose
You probably want to use autoOpen: false
See updated fiddle:
http://jsfiddle.net/jensbits/bGuLj/5/
Try,
$(DialogDiv).dialog({
bgiframe: true,
resizable: false,
buttons: {
{ "Save": function() { saveCallback();} },
{ "Cancel": function() { cancelCallback(); }
}
});
JQueryUI expects an object
for buttons
but, you are passing array
.
精彩评论