[RESOLVED]Jquery UI dialogue not opening second time?

Hi, I have a MVC Razor partial view loaded in a JQuery dialogue.

It opens fine for the first time but not after that.

Also the close button does not work on dialogue window, the "X" icon in top right closes it fine.

here is my code:

<script src="@Url.Content("~/Scripts/jquery-1.7.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.js")"></script>

<script type="text/javascript">
    $(function () {
        $('#dialog').dialog({
            autoOpen: false,
            height: 'auto',
            width: 700,
            modal: true,
            open: function (event, ui) {
                $(this).load("@Url.Action("Create", "Invoice")");
            },
            buttons:
                {
                    "Close": function () {
                        $(this).dialog("close");
                    }
                }
            });

        $("#opener").click(function (e) {
            e.preventDefault();
            $("#dialog").dialog("open");
               });
    });

</script>


<div id="dialog" title="Add Plot">Please wait</div>

<p>
    <a href="#" id="opener" name="opener" class="m-btn green-stripe" style="margin-bottom: 15px; margin-left: 10px;"><i class="icon-plus"></i>Add Plot</a>
</p>

Thanks & Regards
 

Got it.

http://forums.asp.net/t/1960119.aspx?Jquery+dialog+is+not+working+at+the+second+time+in+mvc+4+

Leave a Reply