Jquery UI 对话框..在主页上加载对话框内容
我正在激活一个对话框,如下所示:
$('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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在页面上隐藏此 div。然后该对话框将取消隐藏并为您显示它。
You need to hide this div while it is on the page. The dialog will then unhide it and display it for you.
使用CSS添加
显示:无;
或使用 JQuery 添加
$('#popup').hide();
using css add
display:none;
or using JQuery add
$('#popup').hide();
它位于主页上,因为那就是您放置它的位置!
您需要在首次创建 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.