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 622853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:01:45+00:00 2026-05-13T19:01:45+00:00

I trying to create an HTML/CSS/JavaScript based list manager. I’m using text input fields

  • 0

I trying to create an HTML/CSS/JavaScript based list manager.

I’m using text input fields as my individual list items, with the first text input field being:

<input type="text" id="input1" value="Enter your first item" />

I’m using jQuery to create a new text input field if I’ve used the previous text input field:

<input type="text" id="input2" value="Add another item" />

The jQuery code checks if the value of the first text input field has changed, and then creates the second text input field.

If the value of the second text input field changes, then I want a third text input field to be created:

<input type="text" id="input3" value="Add another item" />

I use jQuery to keep track of the ids of each text input field, and to manage the creation of new ones. However, it only creates a new text input field only if the first text input field, input1, changes. I want it to create a new text input field if the last text input field changes. This is the code I use to create the new text input field:

oldNum = newNum;
newNum++;
var newElement = $("#input" + oldNum).clone().attr('id', 'input' + newNum).attr('value', 'Add another item');
$("input").last().after(newElement);

Thanks in advance for your help.

R

  • 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-13T19:01:45+00:00Added an answer on May 13, 2026 at 7:01 pm

    You can use jQuery’s live function to only handle the change event for the last input, like this:

    $('input:last-child').live('change', function() {
        $(this).after('<input id="input' + ++newNum + '" value="Add another item" />');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 495k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Were the buffers in question opened prior to adding &… May 16, 2026 at 11:31 am
  • Editorial Team
    Editorial Team added an answer Regex.Escape(string) will return a Regex pattern that matches the supplied… May 16, 2026 at 11:31 am
  • Editorial Team
    Editorial Team added an answer When you add service reference it by default creates new… May 16, 2026 at 11:31 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to create a simple iPhone application using HTML/JavaScript/CSS with the help
I am trying to create a new html component using javascript and CSS. The
I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS.
I'm trying to create a file listing a la windows explorer in HTML/Javascript. As
I'm in the process of learning Javascript and I'm trying to create a simple
I'm in the process of learning Javascript and I'm trying to create a simple
I'm trying to create a variable background, where the image changes based on the
I'm trying to create a simple report on an intranet site. Based on this
I'm fairly proficient in HTML/CSS, but very new when it comes to the likes
I am trying to create my own functions in the subclass of BaseHTTPRequestHandler as

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.