behzad n
behzad n

Reputation: 249

New jQuery dialog with each click

How can we use one button to open more one jQuery dialog ?

<script>
$(document).ready(function() {
    $("#private1").dialog({
    beforeClose: function(event, ui) {
    removeprivate();
   },
    width: 460,
    height: 300,
    closeOnEscape: false,
    hide: "fadeout",
    resizable: false,
    }
    );
  });
</script>
<div id="dialog" title="hi"></div>

I want when click link open one dialog and when click again open another dialog and more.

Upvotes: 0

Views: 143

Answers (2)

Thulasiram
Thulasiram

Reputation: 8552

 function TestMessage(message) {
            $('<div class="TestDialog"></div>').appendTo('body')
                    .html('<div><h6>' + message + '</h6></div>')
                    .dialog({
                        modal: true, title: 'Test message', zIndex: 10000, autoOpen: true,
                        width: 460, height: 300, modal: false, resizable: false, closeOnEscape: false,
                        //hide: "fadeout",
                        beforeClose: function (event, ui) {
                            //removeprivate();
                        },
                        buttons: {
                            Ok: function () {
                                $(this).dialog("close");
                            }
                        },
                        close: function (event, ui) {
                            $(this).remove();
                        }
                    });
        };

        $(document).ready(function () {
            $('#btnTest').live('click', function () {
                TestMessage('Hi!');
            });
        });

for live demo see this link: http://jsfiddle.net/nanoquantumtech/sqdkB/

Upvotes: 1

deerchao
deerchao

Reputation: 10544

 $('.button').click(function() {
      $('#dialog').clone().appendTo('body').dialog({
           //your dialog options goes here
      }).dialog('open');
 }));

Upvotes: 1

Related Questions