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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:27:34+00:00 2026-05-11T07:27:34+00:00

In the following: <select id=test> <option value=1>Test One</option> <option value=2>Test Two</option> </select> How can

  • 0

In the following:

<select id='test'>     <option value='1'>Test One</option>     <option value='2'>Test Two</option> </select> 

How can I get the text of the selected option (i.e. ‘Test One’ or ‘Test Two’) using JavaScript

document.getElementsById('test').selectedValue returns 1 or 2, what property returns the text of the selected option?

  • 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. 2026-05-11T07:27:34+00:00Added an answer on May 11, 2026 at 7:27 am
    function getSelectedText(elementId) {     var elt = document.getElementById(elementId);      if (elt.selectedIndex == -1)         return null;      return elt.options[elt.selectedIndex].text; }  var text = getSelectedText('test'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following select element with an onchange event. <select name=ftest onchange=alert('test');> <option
If I had the following select, and did not know the value to use
Using the following query: SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN
Given the following URL (working, try it!) https://select-test.wp3.rbsworldpay.com/wcc/purchase?instId=151711&cartId=28524&currency=GBP&amount=1401.49&testMode=100&name=Tom%20Gul&address=24%20House%20Road \nSome Place\nCounty&postcode=TR33%20999&email=email@mail.com&country=GB If you click on
I need to solve the following question which i can't get to work by
I'm doing something like the following: SELECT * FROM table WHERE user='$user'; $myrow =
I've just discovered that Oracle lets you do the following: SELECT foo.a, (SELECT c
The following SQL: SELECT notes + 'SomeText' FROM NotesTable a Give the error: The
The following SQL SELECT * FROM customers converted to this in LINQ var customers
I have the following query: select column_name, count(column_name) from table group by column_name having

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.