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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:38:13+00:00 2026-06-01T14:38:13+00:00

<Select> <option value=1>One</option> <option value=2>Two</option> <option value=3>Three</option> </Select> I am using document.getElementById(Example).value; to get

  • 0
<Select>
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
</Select>

I am using document.getElementById("Example").value; to get the value.

I want to display the text instead of the value. eg. value=1 --> One. How can I get the One text?

  • 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-01T14:38:14+00:00Added an answer on June 1, 2026 at 2:38 pm

    In plain JavaScript you can do this:

    const show = () => {
      const sel = document.getElementById("Example"); // or this if only called onchange
      let value = sel.options[sel.selectedIndex].value; // or just sel.value
      let text = sel.options[sel.selectedIndex].text;
      console.log(value, text);
    }
    
    window.addEventListener("load", () => { // on load 
      document.getElementById("Example").addEventListener("change",show); // show on change
      show(); // show onload
    });
    <select id="Example">
      <option value="1">One</option>
      <option value="2">Two</option>
      <option value="3">Three</option>
    </select>

    jQuery:

    $(function() { // on load
      var $sel = $("#Example");
      $sel.on("change",function() {
        var value = $(this).val();
        var text = $("option:selected", this).text();
        console.log(value,text)
      }).trigger("change"); // initial call
    });
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <select id="Example">
      <option value="1">One</option>
      <option value="2">Two</option>
      <option value="3">Three</option>
    </select>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have a select list: <select id='myList'> <option value=>zero</option> <option value=1>one</option> <option value=2>two</option> <option
I am using this menu on my web page <select id=menu> <option value=1><h1>one</h1></option> <option
I am using following selector to remove single item in select. jQuery(#stateCity option[value='Adak, AK,
I have writen options to a <select> using something like Id.innerHTML = <option value='foo'>Foo</option>;
i have dropdownlist with the values: <select id=myddl name=myddl> <option value=1>One</option> <option value=2>Twooo</option> <option
I have a dropdown like so: <select id=dropdownList> <option val=1>Item One</option> <option val=2>Item Two</option>
<table id=tab border=2> <tbody> <tr> <td>aaa</td><td>aaa</td></tr> <tr> <td>bbb</td><td>bbb</td></tr> <tr> <td><select id=sel> <option value=one>One</option> <option
<table id=tab border=2> <tbody> <tr> <td>aaa</td><td>aaa</td></tr> <tr> <td>bbb</td><td>bbb</td></tr> <tr id=www> <td><select id=sel> <option value=one>One</option>
I'm trying to select the option based on the php variable value. So I

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.