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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:58:49+00:00 2026-05-25T09:58:49+00:00

I am dynamically creating inputs when the users double clicks an element in a

  • 0

I am dynamically creating inputs when the users double clicks an element in a select box. There can be multiple inputs per element type, so I am creating them as HTML arrays. When the inputs are created, a link is also created that points to a javascript function. Said function will open a calendar prompt for the specific field that was clicked. I have narrowed down the issue to the below code:

document.getElementById( 'start_' + field + '[]' ).length

As you see, I am trying to grab the length of the array just like I would with a normal javascript array. This, of course, is not working. I am unable to find anything on Google referencing this, which usually means it is impossible but I find that hard to believe.

Alternatively, I can increment a variable every time this field is created I just wanted to make sure I am not missing something painfully obvious.

Thank you in advance!

{EDIT}

Please reference http://www.thefutureoftheweb.com/blog/use-arrays-with-html-form-inputs before telling me that HTML does not allow arrays.

{DoubleEdit+Answer}

The issue was not that HTML arrays do not exist, but that the ID attribute cannot be an array. I found http://roshanbh.com.np/2008/08/handling-array-html-form-elements-javascript-php.html which explains how to do what I need…ish.

  • 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-25T09:58:49+00:00Added an answer on May 25, 2026 at 9:58 am

    You can use the following pure JavaScript code:

    oForm = document.forms[0];
    oForm.elements['start_' + field + '[]'].length;
    

    Or in jQuery library:

    $('input[name="start_' + field + '[]"]').length;
    

    I would prefer the second because I am not 100% sure about cross-browser compatibility of the first solution.

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

Sidebar

Related Questions

I have a select box that gets generated dynamically. I want to allow users
i am dynamically creating sql query for inserting multiple records in one hit.Suppose no
I'm dynamically creating textfields in as3, and formatting them with the TextFormat class. I'm
I am creating input boxes dynamically to capture inputs for a certain word (e.g.
I am dynamically creating textboxes using document.createElement('input') and adding a break between them using
In a beginner's programming book (free licence) there was the following code, dynamically creating
I am dynamically creating forms dynamically according to a users actions. It is an
I'm creating some object types dynamically using type function. Ex return type('DynamicType', (object,), dict)
Ok, I'm dynamically creating Asp.net validation controls and inserting them into an update panel.
I have a program that I am creating that creates task inputs dynamically. My

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.