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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:55:14+00:00 2026-06-07T11:55:14+00:00

This is a snippet from something really simple I’m working on (unfortunately, I do

  • 0

This is a snippet from something really simple I’m working on (unfortunately, I do not have much experience in Javascript). Basically, I need to print the values of multiple dynamic text fields in order (I’m assuming dynamic is the right word; more text boxes can be added or taken away depending on how many are needed). They are labeled like so:

<li><input type="text" name="feature_1" id="feature_1" /></li>
<li><input type="text" name="feature_2" id="feature_2" /></li>
etc
etc

I’ve been using this to try and get the input values from the text boxes.

amount = 4; //this is actually the total number of text boxes used
var count = 1;
while (count <= amount) {
        var feature_text = "form.feature_" + count + ".value";
        text += ("<li>" + feature_text + "</li>\n");
        count++;
    }

Unfortunately, this outputs

<li>form.feature_1.value</li>
<li>form.feature_2.value</li>
<li>form.feature_3.value</li>
<li>form.feature_4.value</li>

instead of

<li>Value 1</li>
<li>Value 2</li>
<li>Value 3</li>
<li>Value 4</li>

What do I do to get “feature_text” to pull the values instead of outputting a string?

  • 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-06-07T11:55:15+00:00Added an answer on June 7, 2026 at 11:55 am

    Try this out

    var feature_text = document.getElementById("feature_" + count).value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a little snippet from a little flash game I'm working on: This
I have this snippet of code from a class created by Erica Sadun, that
I have a tsql snippet similar to this: select p.Make, count(p.Make) as _count from
Apologies if this is something really simple. I've found various C# examples here, but
This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName');
I tried to use this snippet from the Soundcloud API: <script src=http://connect.soundcloud.com/sdk.js> <script> SC.initialize({
I've just read this snippet from another answer : When you create a block
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
I'm having problems with the getline instruction from fstream. this is a snippet from
This is a code snippet from O'Reilly Learning Opencv, cvNamedWindow(Example3, CV_WINDOW_AUTOSIZE); g_capture = cvCreateFileCapture(argv[1]);

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.