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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:49:38+00:00 2026-06-15T21:49:38+00:00

Imagine that you have an array like this: myArray[0] = 1,2,3 myArray[1] = 2,3,5

  • 0

Imagine that you have an array like this:

myArray[0] = 1,2,3
myArray[1] = 2,3,5
myArray[2] = 1,4,5

Where (1,2,3),(2,3,5),(1,4,5) are combobox values.

eg. When myArray[0]:

<select name="somename" id="someid">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>

eg. When myArray[1]:

<select name="somename" id="someid">
<option value="2">two</option>
<option value="3">three</option>
<option value="5">five</option>
</select>

Now, the point is assign one of this myArray[] values to the comboboxes? Is it possible?
Cheers

  • 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-15T21:49:40+00:00Added an answer on June 15, 2026 at 9:49 pm

    No jQuery, assuming you have the “Select” object already:

    var s = document.getElementById('someid');
    var words = ["one", "two", "three", "four", "five"];
    
    for(var i = 0; i < myArray[0].length; i++){
       var t = document.createElement("option")
       t.value = myArray[0][i];
       t.textContent = words[myArray[0][i]-1];
       s.appendChild(t)
    }
    

    (Working Example)

    Otherwise, add:

    var s = document.createElement("select");
    s.id = 'someid';
    s.name = 'somename';
    var words = ["one", "two", "three", "four", "five"];
    
    for(var i = 0; i < myArray[0].length; i++){
       var t = document.createElement("option")
       t.value = myArray[0][i];
       t.textContent = words[myArray[0][i]-1];
       s.appendChild(t)
    }
    document.body.appendChild(s);
    

    I prefer manual DOM manipulation (.textContent) over innerHTML, because innerHTML forces the browser to re-parse the entire DOM, each time it is used, since the browser can’t possibly predict the structure of the added HTML. This makes DOM manipulation render faster than when using innerHTML

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

Sidebar

Related Questions

I have an array that looks like this. Imagine there are 10 other keys
Imagine I have an JS array like this: var a = [1, 2, 3,
So I have a multi-dimensional array looks like this. $config = array( First Name
Imagine that i have the following code: <a:repeat value=#{bean.getList()} var=x > <li class=la> <span>
Let's imagine that I have list of files at host1 find /path/to -name *.jpg
I would like to ask you: Imagine that you have a site and there
I'm creating my own JavaScript Array-like object and I have methods that call closures.
I have a C structure that looks like this typedef struct event_queue{ Event* event;
Say I have a block like this: <% @help_sections.each do |section| %> <li><%= section.name
I have some difficulties to select certain elements of an array in C#. Imagine

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.