Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery UI dialog buttons text not working

I am creating a modal JQuery UI Dialog box and storing the result in the $dialog variable. The buttons change depending on which operation is chosen, so I set the buttons using a function call like this:

$dialog.dialog( "option", "buttons", [
    {
        text: "Ok",
        click: function() { close_project(); }
    },
    {
        text: "Cancel",
        click: function() { ($this).dialog("close"); }
    }
]);

This displays two buttons with the text '0' and '1' in them instead of 'Ok' and 'Cancel'. Also, the click functions do not appear to be working.

I've gone over this a number of times and the syntax looks correct. What am I doing wrong?

like image 743
arthuston Avatar asked Mar 07 '11 22:03

arthuston


1 Answers

jQuery UI help for this says method you are using is for modal already initialized - http://jqueryui.com/demos/dialog/#option-buttons Is this the case?

If not, try this one and then experiment how it is different or suitable for your solution:

$dialog.dialog({ buttons: [
    {
        text: "Ok",
        click: function() { close_project(); }
    },
    {
        text: "Cancel",
        click: function() { $(this).dialog("close"); }
    }
]});
like image 52
rdamborsky Avatar answered Oct 13 '22 00:10

rdamborsky