Show dynamic dialog box using JQuery

jQuery ui

Dialog box is commonly used user interface for the web development, especially to show the action information to the user. Some time we need to show the dialog box with dynamic content, you can get some idea from the below example.

The demo demonstrate how to implement a jQuery dialog modal that will contain the content according button type.


Source Code

<html xmlns="">
    <title>show dynamic dialog box in jquery</title>
<link href="" rel="stylesheet" type="text/css"/>
  <script src=""></script>
  <script src=""></script>
      <script type="text/javascript">
        $(function() {
            $("input:button").click(function() {
                var NewDialog;
                var _id = $(this).attr('id');
                if (_id == "Button1") {
                    NewDialog = $('<div class="popup" title="Save item">\
          Item has been saved successfully!</div>');
                else if (_id == "Button2") {
                    NewDialog = $('<div class="popup" title="Update item">\
          Item has been updated successfully!</div>');
                else if (_id == "Button3") {
                    NewDialog = $('<div class="popup" title="Delete item">\
          Item has been deleted successfully!</div>');
                    resizable: false,
                    modal: true,
                    show: 'clip',
                    buttons: {
                        "Ok": function() {
<div style="width:400px;height:400px"> 
<input id="Button1" type="button" value="Save" />
<input id="Button2" type="button" value="Update" />
<input id="Button3" type="button" value="Delete" /></div></center>