2012-07-12 84 views
0

我使用加載函數加載頁面時對話框未打開,但是當我刷新頁面時,對話框工作。警報正在使用load()。有什麼建議麼?使用加載函數在頁面加載後未打開jquery對話框

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

這個函數在[ready](http://api.jquery.com/ready/)函數中嗎? – 2012-07-12 14:05:28

+0

在您的瀏覽器的JavaScript控制檯中是否有任何錯誤? – AdmSteck 2012-07-12 14:09:05

+0

這是一個準備好的功能,並沒有在控制檯中的錯誤。如果我把像下面那麼「this._mouseInit不是一個函數」將發生 – muthu 2012-07-13 04:04:07

回答

0

它看起來像你試圖打開當您單擊edit-address-map元素上edit-address-map-div對話框。對?

$(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'); } 
    }); 
}); 
相關問題