Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6540217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:57:06+00:00 2026-05-25T10:57:06+00:00

i am learn to make a multiple step form. i use this jquery code

  • 0

i am learn to make a multiple step form. i use this jquery code :

    $('nav a:last').replaceWith('<a href="#" id="navbtnnext" class="navbtnnext_0">');

    $('form').submit(function(){
        return false;
    });

    $('button.submit_step1, nav a.navbtnnext_0').click(function(){
        $('nav a:first').replaceWith('<a href="#" id="navbtnprev"></a>');
        $('.step1').slideUp();
        $('.step2').slideDown();
        $('nav a#navbtnnext').removeClass('navbtnnext_0').addClass('navbtnnext_1');
    });

    $('button.submit_step2, nav a.navbtnnext_1').click(function(){
        $('.step2').slideUp();
        $('.step3').slideDown();
        $('nav a#navbtnnext').removeClass('navbtnnext_1').addClass('navbtnnext_2');
    });

    $('button.submit_step3, nav a.navbtnnext_2').click(function(){
        $('.step2').slideUp();
        $('.step3').slideDown();
        $('nav a#navbtnnext').removeClass('navbtnnext_2').addClass('navbtnnext_3');
    });

when i clicked nav a.navbtnnext_1 why .step2 not change into .step3?! something wrong with my code? please help me..

here’s my html code :

       <nav class="grid_12">
            <a id="navbtnprevdisabled"></a>
            <a id="navbtnnextdisabled"></a>
        </nav>
        <div class="clear"></div>
        <div id="main" class="grid_12" role="main">
            <section id="form">
                <form>
                    <div class="step1">
                        test 1
                        <hr>
                        <button class="submit_step1">Next</button>
                    </div>
                    <div class="step2">
                        test 2
                        <hr>
                        <button class="submit_step2">Next</button>
                    </div>
                    <div class="step3">
                        test 3
                        <hr>
                        <button class="submit_step3">Next</button>
                    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:57:06+00:00Added an answer on May 25, 2026 at 10:57 am

    Having those hard-coded buttons in there makes it difficult to scale your form. It would be better if you just used classes instead of ids for the buttons.

    This is the most basic example that I can come up with.

    $(document).ready(function(){
    
      $('.btnNext').click(function(e){
        e.preventDefault();
        $(this).closest('fieldset').slideUp().next().slideDown();
    
      });
      $('.btnPrev').click(function(e){
        e.preventDefault();
        $(this).closest('fieldset').slideUp().prev().slideDown();
    
      });
    });
    

    And here is the html to go with it.

      <form>
        <fieldset>
          <legend>Step 1</legend>
          <input /><br/>
          <button class="btnNext">Next</next>
        </fieldset>
        <fieldset class="hidden">
          <legend>Step 2</legend>
          <input /><br/>
          <button class="btnPrev">Previous</button><button class="btnNext">Next</button>
        </fieldset>
        <fieldset  class="hidden">
          <legend>Step 3</legend>
          <input /><br/>
          <button class="btnPrev">Previous</button><button class="btnNext">Next</button>
        </fieldset>
        <fieldset  class="hidden">
          <legend>Step 4</legend>
          <input /><br/>
          <button class="btnPrev">Previous</button><button class="btnNext">Next</button>
        </fieldset>
        <fieldset  class="hidden">
          <legend>Step 5</legend>
          <input /><br/>
          <button class="btnPrev">Previous</button><input type="submit" />
        </fieldset>
      </form>
    

    And finaly here is a link to a working example http://jsbin.com/oyoboc/2/edit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i would like to learn how to make PHP/CSS syntax generator. i assume this
A sysadmin teacher told me one day that I should learn to use make
I would like to make a simple desktop application to learn this kind of
I am trying to learn to use the wx packages to make GUI programs
I'm trying to learn jQuery, to make up for my anemic javascript skills. As
This is why I'm asking this question: Last year I made some C++ code
I would like to make (or learn how to make) VST plugins. Is there
Im starting to learn RoR and i want to make my personal blog in
I'm trying to learn redcode, because it looks fun to make a bot. Introduction
Whenever I learn a new language/framework, I always make a content management system... I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.