使用load函数加载页面后,jquery对话框未打开

时间:2012-07-12 13:58:02

标签: jquery jquery-ui

我正在使用加载功能加载页面,对话框未打开,但是当我刷新页面时,对话框已经完成。警报正在使用load()。有什么建议?

jQuery( "#edit-address-map" ).live('click', function(){
            alert('in');
            jQuery( "#edit-address-map-div" ).dialog({ 
                modal: true,
                height:370,
                width:350,
                resizable: true,
                draggable: false,
                dialogClass: "flora",
                close: function(ev, ui) { jQuery(this).dialog('destroy'); }

             });    

        });

1 个答案:

答案 0 :(得分:0)

当您点击edit-address-map-div元素时,您似乎正在尝试打开edit-address-map对话框。正确?

$(function() {

    jQuery( "#edit-address-map" ).live('click', function(){
        alert('in'); 
        $('#edit-address-map-div').dialog("open"); // raise the open event on click
    });

    // wire up the dialog properties when the DOM loads
    jQuery( "#edit-address-map-div" ).dialog({ 
        autoOpen: false, // so it won't open when the page loads
        modal: true,
        height:370,
        width:350,
        resizable: true,
        draggable: false,
        dialogClass: "flora",
        close: function(ev, ui) { jQuery(this).dialog('destroy'); }
    });   
});