Jquery UI 对话框..在主页上加载对话框内容

发布于 2024-12-22 16:27:49 字数 417 浏览 2 评论 0原文

我正在激活一个对话框,如下所示:

   $('a#addNew').click(function(){
   $('#popup').dialog({
       minWidth:  700,
       title:     'Select a product item'
   });
});

<div id="popup" style="color:#fff; background:#000; width:650px;">
    blah blah blah blah
</div>

这一切都很好..但是对话框(#popup)实际上显示在我的页面上,直到我单击#addNew,在这种情况下它会消失并转移到实际的对话框。我只希望用户在单击#addNew 时看到该信息。我不希望它出现在页面上。我在这里做错了什么?

I am activating a dialog box like so:

   $('a#addNew').click(function(){
   $('#popup').dialog({
       minWidth:  700,
       title:     'Select a product item'
   });
});

<div id="popup" style="color:#fff; background:#000; width:650px;">
    blah blah blah blah
</div>

thats all well and good.. but the dialog box (#popup) is actually showing up on my page until i click #addNew, in which case it disappears and transfers to the actual dialog box. I only want the user to see that information when they click on #addNew. I dont want it to be sitting on the page. What am i doing wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是我以为 2024-12-29 16:27:49
<div id="popup" style="color:#fff; background:#000; width:650px; display:none;">
    blah blah blah blah
</div>

您需要在页面上隐藏此 div。然后该对话框将取消隐藏并为您显示它。

<div id="popup" style="color:#fff; background:#000; width:650px; display:none;">
    blah blah blah blah
</div>

You need to hide this div while it is on the page. The dialog will then unhide it and display it for you.

回忆躺在深渊里 2024-12-29 16:27:49

使用CSS添加
显示:无;

或使用 JQuery 添加
$('#popup').hide();

using css add
display:none;

or using JQuery add
$('#popup').hide();

淡写薰衣草的香 2024-12-29 16:27:49

它位于主页上,因为那就是您放置它的位置!

您需要在首次创建 div (css - display: none) 时将其隐藏。

It's on the main page because that's where you put it!

You need to hide the div (css - display: none) when its first created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文