jQueryUI Dialog

by Rob Sedgwick

HTML

<div id="myDialog">
  Hello there
</div>

<button id="clickMe">Click Me</button>

JavaScript

//Set up the dialog box
$("#myDialog").dialog({
  autoOpen: false,
  modal: true,
  title: "Underpants",
  buttons: {
/*    'OK': function() {
      //var textValue = $('#myTextBox').val();
      //alert('The value of the text box is ' + textValue);
      //Now you have the value of the textbox, you can do something with it, maybe an AJAX call to your server!
    }, */
    'Close': function() {
      $(this).dialog('close');
    }
  }
});

//Open the dialog box when the button is clicked.
$('#clickMe').click(function() {
  $("#myDialog").dialog("open");
});