隐藏当前元素,并显示下一个 [英] Hide current element and show the next one
问题描述
我创建一个ASP.NET应用程序,你表明了白卷。这个测验应该是秀显示问题所涉及的用户。
I'm creating a ASP.NET application where shows you a quiz. This quiz should be show to the user displaying question by question.
我的意思是,将出现第一个问题,当他$下一个P $ PSS按钮,隐藏当前的问题元素,显示下一个,直到它有没有元素展现。
I mean, appears the first question and when he press the button next, hide the current question element and show the next one until it has no elements to show.
到了那一刻,我只是完成秀MVC4所有。我真的不使用JQuery太多经验。
By the moment, I just have accomplish show all of them in MVC4. I really have not to much experience using JQuery.
<div id="questions-container">
<div class="question">
...
</div>
<div class="question">
...
</div>
<div class="question">
...
</div>
<div class="question">
...
</div>
</div>
你能定位,我怎么能实现这个功能?谢谢
Can you orient about how can I implement this feature? Thanks
推荐答案
默认的所有问题显示:无;
,显示第一个页面加载时(或另一类 .question.first
有显示:块;
,然后下一个按钮可以显示下一个问题
Default all questions to display: none;
, show the first one when the page loads (or with another class .question.first
that has display: block;
, and then the next button can show the next question with:
$("#questions-container").find(":visible").hide().next().show();
这篇关于隐藏当前元素,并显示下一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!