views:

201

answers:

1

hi all,

i've defined a dialog with 2 buttons: ok + cancel. what i want to do now is change the ok button's function after initialization, so i tried:

dlgPrompt.dialog({
    buttons: {
        'Ok': function() {
            myFunction();
            $(this).dialog('close');
        }
    }
});

unfortunately it doesnt work (when clicking ok, nothing happens). anyone knows whats wrong?

thx

+1  A: 

You need to call the 'option' method, like this:

dlgPrompt.dialog('option', 'buttons', {
    'Ok': function() {
        myFunction();
        $(this).dialog('close');
    }
});
SLaks