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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:02:36+00:00 2026-05-26T05:02:36+00:00

I have a code like this: var a = selectBox.options[selectBox.selectedIndex]; If I execute: alert(a);

  • 0

I have a code like this:

var a = selectBox.options[selectBox.selectedIndex];

If I execute:

alert(a);

Using FF, Chrome, Opera, etc… I get:

[object HTMLOptionElement]

Which is exactly what I want.
If I use IE6 or IE7, I get:

[object]

With no expected Option properties at all.
This means that there is no TextNode as a childNode and no value property. How can I solve that problem?
Also if I try to use that node to add to another select box IE throws an exception:

SCRIPT87: Invalid argument.

I was requested to make a program that is compatible with IE6 but I can’t find a way to make it work. I need to move Option objects around and IE7 is not allowing me.

Edit by request:
Context HTML

                <select id="identification">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select>

                    <select id="toBeFilled" multiple>
                </select>

Important note:
What I’m making NEVER knows the list of names and ids of the document. It only knows the nodes which it will use to work in the document.
When I state Node I mean, for instance, what document.getElementById() returns.

  • 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-26T05:02:37+00:00Added an answer on May 26, 2026 at 5:02 am

    var a = selectBox.options[selectBox.selectedIndex]; will definitely give you an Option object (or HTMLOptionElement) in all browsers, IE 7, 6, 5, 4 and possibly 3 included (although IE may not give you a particularly helpful value when you call toString(), as you’ve observed). This will have text and value properties that reflect the text and value of the option. If this isn’t working for you then there’s a problem elsewhere in your code.

    As for transferring options between select boxes, I’m not so sure on this, but if in doubt you could just create a new Option and add that to your new select box:

    var newOption = new Option(a.text, a.value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When we have code like: function a(){ var x =0; this.add=function(){ alert(x++); } }
I have code like this: var newMsg = new Msg { Var1 = var1,
I have code like this var MyObj = { f1 : function(o){ o.onmousedown =
This is a really basic question but... I have some code like this var
If I have code like this: public XALServiceConfiguration CreateInstance() { var config = ConfigurationManager.GetSection(ConfigurationSectionName)
I have some LINQ code that generates a list of strings, like this: var
I have code like this: template <typename T, typename U> struct MyStruct { T
I have code like this to move the player in my game left, right,
I have code like this: ... entry.KeyPressEvent += EntryKeyPressEvent; ... } void EntryKeyPressEvent(object o,
I have code like this: string uriString = @C:\Temp\test.html; Uri uri = new Uri(uriString);

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.