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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:55:00+00:00 2026-06-02T02:55:00+00:00

I am trying to change the value of span when the user selects an

  • 0

I am trying to change the value of span when the user selects an option from the dropdown but this doesn’t seem to be working.

HTML:

<tr>
                    <td class="field" colspan="4">
                    <select id="mmt">
                    <option value="Metric" selected>METRIC</option>
                    <option value="English">ENGLISH</option>
                    </select></td>
                </tr>
                <tr>
                    <td class="head"><label for="abc">ABC</label></td>
                    <td class="field"><input type="text" id="abc"/><span class="m">MM</span> OD</td>
                    <td class="head"><label for="pqr"></label></td>
                    <td class="field"><input type="text" id="pqr" /><span class="ms">MM</span></td>
                </tr>
                <tr>
                    <td class="head"><label for="xyz">XYZ</label></td>
                    <td class="field"><input type="text"  id="xyz" /></td>
                    <td class="head"><label for="stu"></label></td>
                    <td class="field"><input type="text" id="stu"/><span class="ms">MM</span></td>
                </tr>

jQuery:

$(function() {          
                    $('#mmt').change(function() {
                        if ($('#mmt option:selected').text() == "English") {
                            $('.ms').text("INCH");
                        }
                        else {
                            $('.ms').text("MM")     
                        }

                    });

        });
  • 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-02T02:55:01+00:00Added an answer on June 2, 2026 at 2:55 am

    $('#mmt option:selected').text() will either return "METRIC" or "ENGLISH", but never "English".

    You want the value of the select element, not the text content of the selected option.
    For that use $('#mmt').val() [docs], or simply $(this).val(), since this refers to the select element.

    DEMO

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

Sidebar

Related Questions

I'm trying to execute this function when a select list's (LevelId0) value change but
I am trying to change the value of the onclick attribute: <span onclick=addPropertyToQuery(this) tagId=${property.id}
I'm trying to change the value of a dojo tree to display the correct
I am trying to programmatically change a value of a wxRadioButton in a way
I'm trying to use jQuery to change the value of button.kill . However I
I'm trying to change the color of a UILabel depending on the .text value
I am trying to make a numerical value, say 5000, quickly change to another
I'm trying to change some config file user settings values in my WPF application,
I'm trying to update/change contact ringtone using this code: ContentValues values = new ContentValues();
I'm trying to change the value on the page while when loaded and changing

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.