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 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 new member here. Nice to see such a neat community. After a bit
a nice member here helped me set up a multiple checkbox example that stores
One of the really nice things about python is the simplicity with which you
Hello is nice to be a new member of the community and thanks for
I found the very nice demo by Oleg (http://www.ok-soft-gmbh.com/jqGrid/FillToolbarSearchFilter.htm) which shows a jqGrid toolbar
Any nice Paneled user interface component COM/ ActiveX /Source-code for C# /VB? Like what
What is a nice way to end an interview that is clearly going badly?
It'd be really nice to target my Windows Forms app to the .NET 3.5
I recently read a nice post on using StringIO in Ruby. What the author
The only nice way I've found is: import sys import os try: os.kill(int(sys.argv[1]), 0)

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.