gpt4 book ai didi

javascript - jquery 模态对话框在 mock 我 - 对话框显示为无模式

转载 作者:行者123 更新时间:2023-11-28 03:19:34 24 4
gpt4 key购买 nike

我在尝试显示一个简单的 jquery 模态对话框时遇到了困难。对话框以无模式方式显示。

我已阅读其他帖子并检查:

  • 有一个指向 jquery-ui.css 的链接
  • 我添加了 modal:true 参数。

我做错了什么?

HTML

<div id="userPanelDlg">
<div class="input -clearfix">
<p>User</p>
<input name="username" type="text">
<p>Pass</p>
<input name="password" type="text">
</div>
</div>

Javascript

$("#userPanelDlg").dialog({
resizable: false,
height: 'auto',
width: 'auto',
modal: true,
buttons: {
"Ok": function () {
$(this).dialog("close");
}
}
});

最佳答案

我发现了问题。我误解了一个基本的 javascript 概念。对话框显示为模态,但在调用 dialog() 之后执行。我认为,与 java 等其他语言一样,dialog({modal:true}) 是一个阻塞调用(如 java 中的 dialog.setVisible(true))。谢谢你的帮助

关于javascript - jquery 模态对话框在 mock 我 - 对话框显示为无模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25258773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com