I am doing some sort of dynamic quiz using jquery. I am currently stuck at hiding/showing the divs using the same button. So, for example, I have this in html:
<div id="div1" class="question">
<div id="div2" class="question">
<div id="div3" class="question">
<div id="div4" class="question">
<div id="div5" class="question">
<button type="button" onclick="GetSelectedItem()" id="next">Next</button>
This is the jquery part:
$(document).ready(function (){
$('#div2, #div3, #div4, #div5').hide();
$('#next').click(function(){
//code
});
});
Using the '#next' button I would like to go through every div, so when I press it it will hide the previous div and show the next one and so on. Could anyone point me in the right direction? Thanks