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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:05:53+00:00 2026-06-09T10:05:53+00:00

I have 2 select lists. There is a check box that when it is

  • 0

I have 2 select lists. There is a check box that when it is clicked it needs to feed the selected value selected into the other list.

I am up to the stage where I have managed to alert back the selected value in the first select list, my question is how to get the value in the second select list when the checkbox is clicked:

Please check code below of how far I have got:

<!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">

    function displayResult() {
      if(document.form1.billingtoo.checked == true) {
        var x = document.getElementById("mySelect").selectedIndex;
        var y = document.getElementById("mySelect").options;
        alert(y[x].text);
      }
    }

    </script>
    </head>
    <body>

    <form name="form1">
    Select your favorite fruit:
        <select id="mySelect">
            <option>Apple</option>
            <option>Orange</option>
            <option>Pineapple</option>
            <option>Banana</option>
        </select>

        <br>

        <input type="checkbox" name="billingtoo" onclick="displayResult()">

        <br>

    Select your favorite fruit 2:
        <select id="mySelect2">
            <option>Apple</option>
            <option>Orange</option>
            <option>Pineapple</option>
            <option>Banana</option>
        </select>

    </form>
    </body>
    </html>

thanks.

  • 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-09T10:05:55+00:00Added an answer on June 9, 2026 at 10:05 am

    Just set the selected index of the other select element.

    jsFiddle Example

    if(document.form1.billingtoo.checked == true) {
            var x = document.getElementById("mySelect").selectedIndex;
            var y = document.getElementById("mySelect").options;
            // Set selected index for mySelect2
            document.getElementById("mySelect2").selectedIndex = x;
    }
    

    You could get and set the value property of the object, if you’re worried about the order of options being different.

    jsFiddle Example

    if(document.form1.billingtoo.checked == true) {
            var x = document.getElementById("mySelect").value;
            var y = document.getElementById("mySelect").options;
    
            document.getElementById("mySelect2").value = x;       
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop that generates List of items with Check box to select
I have this dropdown. I need clone for my other dropdown lists: <select name=general>
I have a selection list that is generated dynamically, it lists a number of
I have a list box in which there are around say 10 items. Now
If you have ever used SQL reporting services, there are some dropdown lists that
I have a OrganisationName select box in Edit/Add User Page. <s:select key=user.organisationname name=entity.organisationId list=organisationList
I have a mini form that consists of all select boxes and checkbox lists.
I have 3 select or option drop lists that based on what the users
I have a drop down list where users can select a theme for the
I have two select lists, I would like jquery to either remove or disable

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.