JSFiddle - React, Tailwind, and code Playground
HTML
<div class="page active">
<div style="font-weight:bold">1.How long have you been working in field of Programming?</div><br/>
</div>
<div class="page">
<div style="font-weight:bold">2.Second Question?</div><br/>
</div>
<div class="page">
<div style="font-weight:bold">3.Another Question?</div><br/>
</div>
<button id="prev">Prev</button>
<button id="next">Next</button>
CSS
.page {
display: none;
}
.active {
display: inherit;
}
JavaScript
$("#prev").on("click", function(){
if($(".page.active").index() > 0)
$(".page.active").removeClass("active").prev().addClass("active");
});
$("#next").on("click", function(){
if($(".page.active").index() < $(".page").length-1)
$(".page.active").removeClass("active").next().addClass("active");
});