简体   繁体   English

使用jQuery的按钮和对话框

[英]buttons and dialogs using jquery

I have an button(lets assume it name is 123) and if I press on it then a dialog window (lets assumebr window1) will appear. 我有一个按钮(让我们假设它的名称是123),如果我按下它,则会出现一个对话框窗口(让我们假设它的window1)。 Window1 has 1 button. Window1有1个按钮。 If I press the button then another dialog window appers, which also has 1 button and 2 radio buttons. 如果我按下按钮,则会出现另一个对话框窗口,该窗口也有一个按钮和两个单选按钮。 After the user makes his decision and presses button 2, then both dialog windows should disappear. 用户做出决定并按下按钮2之后,两个对话框窗口都应消失。

I use 我用

$("dialog1").remove();
$("dialog2").remove();

After that if I want to press 123 again, then first (and consequently tse second) window not appears. 之后,如果我想再次按123,则不会出现第一个窗口(因此第二个窗口)。 .detach() is not what I need. .detach()不是我所需要的。 Everything is in the same session. 一切都在同一会话中。 How can I make then to appear again? 我如何才能再次出现? What methods should I use? 我应该使用什么方法?

$.hide() and $.show() , respectively - if you don't want to use them, please update your question and explain why those (or .detatch() ) aren't viable options. $.hide() $.show() $.hide()$.show() -如果您不想使用它们,请更新您的问题并解释为什么这些(或.detatch() )不可行。 The alternative is to recreate the DOM elements, for example using $("<div id="dialog1">stuff</div>"); 另一种方法是重新创建DOM元素,例如使用$("<div id="dialog1">stuff</div>"); , but this is very inefficient compared to hide/show and/or detach. ,但与隐藏/显示和/或分离相比效率很低。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM