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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:45:56+00:00 2026-06-01T16:45:56+00:00

I have a series input tag like <input id=t1 value=1> <input id=t2 value=2> <input

  • 0

I have a series input tag like

<input id="t1" value="1">
<input id="t2" value="2">
<input id="t3" value="3">

then I want build a javascript object as id/value format,like :

input:
{
   ["t1",1]
   ["t2",2]
   ["t3",3]
}

how can I achieve that?with which function or method?with Array?

  • 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-01T16:45:57+00:00Added an answer on June 1, 2026 at 4:45 pm

    The object you describe is invalid. Assuming you mean:

    {
       "t1":1,
       "t2":2,
       "t3":3
    }
    

    Just loop over the elements, and examine the id and value properties to get the data.

    var inputs = document.getElementsByTagName('input');
    var ob = {};
    for (var i = 0; i < inputs.length; i++) {
      var input = inputs[i];
      ob[input.id] = input.value;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of tables that contain data I want to full text
I have a form which contains a series of fields like: <input type=text name=User[123]
I have a series of input boxes that have some values in them. I
I have a series of table rows like this: <cfloop query=qryPlayer> (...snip...) <input data-playerid=#PlayerID#
I have a series of divs that are hidden and I would like to
I have a series of characters that I want to match with a regular
Basically I have a series of divs which contains a label and an input
I have a series of dynamically generated inputs that I need to have ajax
I have a series of urls in a web doc, something like this: <a
I have a series of buttons that display filenames. If I set the Text

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.