Showing and hiding Steps
How to show the next step
by davidpauljunior
HTML
<div id="step1" class="step">
<p>Some content in here</p>
<a href="#step2" class="next">Next</a>
</div>
<div id="step2" class="step hide">
<p>Some content in here</p>
<a href="#step1" class="prev">Previous</a>
<a href="#step3" class="next">Next</a>
</div>
<div id="step3" class="step hide">
<p>Some content in here</p>
<a href="#step2" class="prev">Previous</a>
</div>
CSS
.step {
border: 1px solid #ececec;
padding: 10px;
background: #f0f0f0;
margin-bottom: 10px;
}
.hide {
display: none;
}
JavaScript
var next = $('a.next');
var prev = $('a.prev');
next.click(function(){
$(this).parent('.step').addClass('hide');
$(this).parent('.step').next().removeClass('hide');
});
prev.click(function(){
$(this).parent('.step').addClass('hide');
$(this).parent('.step').prev().removeClass('hide');
});