使用jQuery 1.9.0的jQuery-UI对话框

时间:2013-07-12 19:50:30

标签: jquery jquery-ui

我在我的网页上使用jQuery对话框。将jQuery版本从1.8升级到1.9后,在单击按钮打开对话框页面之前,页面上会显示对话框div。

当我使用jq 1.8时,下面的代码工作,#form在我点击button之前是不可见的。现在我升级到jq1.9,页面上显示#form。知道为什么以及如何解决这个问题?

$(document).on('click', '.button', function(){
    $("#form").dialog("open"); 
});

<div id="form" title="Create new">
   <form>
     <label for="name">Name</label>
     <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
   </form>
</div>

1 个答案:

答案 0 :(得分:0)

按如下方式更新您的JS:

$("#form").dialog({ autoOpen: false });

$(document).on('click', '.button', function(){
    $("#form").dialog("open"); 
});
默认情况下,

autoOpentrue(为了公平,它也是1.8;)