views:

21

answers:

1

Here is the code I'm using

http://jsbin.com/evike5/edit

When the jQuery UI dialog is fired second time. The updated title is not shown.

Am I doing something wrong?

+1  A: 

This is because you're opening the same dialog, for it to take effect you either need to destroy the old dialog, like this:

$("#hello").dialog('destroy').attr("title", "Helloooooooo!")

Try it here.

Or just set the title and button behavior without re-creating the dialog, like this for your OK button:

OK: function () {
  $(this).dialog("close")
         .dialog("option", { 
           buttons: {
             OK: function () {
               $(this).dialog("close");
             }
           }, 
           title: "Helloooooooo!" 
       }).dialog("open");
}

You can give that a try here.

Nick Craver
Thanks a million ton!!
Ismail