javascript - how to make a form to show 3 questions at a time -
i have developed survey form has 13 questions. questions coming in 1 page want show 3 question @ time other 3 question on next page.
i have no idea how this.please me in issue. thanks
this code show 3 item @ time, , show next 3 items when clicked on next button.
var currentpage = 0; var pages = 5; var itemsperpage = 3; var $submitbutton = $("button[type=submit]"); $("li h3").each(function(i, e){ $(e).text((i + 1) + ") " + $(e).text()); }); $("#next").click(function() { $("li") //.css("background", "#fff") .hide(); for(i = 1; <= itemsperpage; i++) { $("li:nth-child(" + ((currentpage * itemsperpage) + i) + ")") //.css("background" , "red") .show(); } if(currentpage == pages - 1) { $submitbutton.show(); } else { $submitbutton.hide(); } if(currentpage < pages - 1) { currentpage += 1; } else { currentpage = 0; } }); $("#next").click();
Comments
Post a Comment