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

  • SEARCH
  • Home
  • 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 6220741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:00:38+00:00 2026-05-24T08:00:38+00:00

a nice member here helped me out to create a form which adds steps

  • 0

a nice member here helped me out to create a form which adds steps as you go. I modified it a bit to allow you to change the answers to some of those questions by clicking a change button. Of course, I realized my limits and applied it to only the first question, and badly…
The way I was approaching this was to give each question and button it’s own unique id, which I think is probably the wrong way to approach this?

This is what I want and I partially accomplished some:

  • Fill out a field, press NEXT
  • Field 1 Turns into readonly text and a ChangeButton appears
  • a new field appears below that you can fill out
  • By pressing CHANGE on field one, field2 becomes non-editable and field1 is now editable. The change button also turns to “Save”. By clicking save, you make field 2 editable and field1 non-editable again.
  • this continues on forever 🙂

I tried what I found on the internet but I hope that someone who’s better at this could help me out a bit if that’s ok 🙂
Here’s my Jfiddle
http://jsfiddle.net/pufamuf/TEyVL/3/

Thank you!

  • 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-24T08:00:38+00:00Added an answer on May 24, 2026 at 8:00 am

    Example of the following here

    Here’s how I’d accomplish what you’re trying to do…

    HTML:

    <div id="question1" class="question active">
        <label>Q1</label>
        <input type="text" />
        <input type="button" value="SAVE" class="button" />
    </div>
    

    jQuery:

    var qa = []; // questions array of objects { text: "question text" }
    
    $('.button').live('click', function(e) {
        var $but = $(this),
            $inp = $but.prev(),
            $parent = $but.parent(),
            i = $parent.attr('id').match(/\d+$/)[0] - 1,
            $new;
    
        if ($but.val() == 'SAVE') {
    
            // store value to array
            qa[i] = {
                text: $inp.val()
            };
    
            // append new question inputs if needed
            if (!$('#question' + (i + 2)).length) {
                $new = $parent.clone();
                $new.attr('id', 'question' + (i + 2));
                $new.find('label').html('Q' + (i + 2));
                $new.find('input[type="text"]').val('');
                $new.insertAfter($parent);
            }
    
            // change to inactive attributes
            $inp.attr('disabled', true);
            $parent.removeClass('active').addClass('answered');
            $but.val('CHANGE');
    
        } else { // CHANGE
    
            // change to active attributes
            $inp.attr('disabled', false);
            $parent.removeClass('answered').addClass('active');
            $but.val('SAVE');
    
        }
    });
    

    I made the array store objects so it’s easy to add other properties to each question if needed.

    See demo

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

Sidebar

Related Questions

a nice member here helped me set up a multiple checkbox example that stores
a new member here. Nice to see such a neat community. After a bit
a nice member helped me preload a css background image, and I thought I
I have a nice interface, and I want to implement one member of it
Nice and (hopefully) easy. I am trying to work out how to grab the
I have a class named Particle which has a std::set as a member. The
Well I tried to figure out is this possible in any way. Here is
I have a C++ class in which many of its the member functions have
Hello is nice to be a new member of the community and thanks for
Using the code posted here , I created a nice hierarchical clustering: Let's say

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.