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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:00:51+00:00 2026-05-24T19:00:51+00:00

Ok, so from what I found googling around, I can do something like (please

  • 0

Ok, so from what I found googling around, I can do something like (please correct me if I’m wrong):

component.options[component.selectedIndex].defaultSelected = true;

But what if I want to change it afterwards? I mean if I do the same action on a different option, will both have defaultSelected to true? Do I need to first go trough all the options and set defaultSelected = false and only after do a re-assigning?

Also is there a easy way to get the defaultSelected option rather than go trough all the options in a loop and return when defaultSelected = true is reached?

Regards,
Bogdan

  • 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-24T19:00:52+00:00Added an answer on May 24, 2026 at 7:00 pm

    More than one option can have its deftaultSelected property set to true. If you don’t know which ones have the defaultSelected property set and you wish to change it, you must iterate over all of them and set the the one you want to be the default to true and the others to false.

    However, there is rarely a need to do so. The defaultSelected property is only used when a form is reset to determine which option will be selected by default. If some other option is selected, it will become the selected option and the default selected option is no longer of interest.

    Setting the default option after the document has loaded does not, of itself, change the option that is selected.

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

Sidebar

Related Questions

I'm trying to understand something that , by googling around, seems like a bug
From googling around, I found that using while loops or using variables is discouraged.
EDIT: The entire code and database creation script can be found from http://gitorious.org/scheator .
Where can I find the IIS object schema? All I found from MSDN was
The articles can be found from Dr. Dobb's web site, but I can't find
Hi i been googling around and couldn't found any answer or approach to this
I have been googling, a lot, and found quiet many similar issues around the
I have been googling around for about an hour, and I still don't found
I'm googling around for a couple of days, and can't find clear method/lib for
Update III: After googling around I've found that this is not an uncommon problem.

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.