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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:46:14+00:00 2026-05-15T01:46:14+00:00

i start learning jquery few days ago, and i like it very much. but

  • 0

i start learning jquery few days ago, and i like it very much. but now i have a problem, that can’t solve alone.

i have two selects

<select id="select1">
  <option value="1">1day</option>
  <option value="2">2day</option>
  <option value="3">3day</option>
</select>

<select id="select2">
  <option value="1">1day</option>
  <option value="2">2day</option>
  <option value="3">3day</option>
</select>

i need to set #select2 the same value with #select1, when #select1 changes

i’ve red some questions about select tag here, but i need to set “selected” attribute to that option, which have the same value. how can i do it?

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-05-15T01:46:14+00:00Added an answer on May 15, 2026 at 1:46 am

    To set the value use .val() like this:

    $(function() { //run on document.ready
      $("#select1").change(function() { //this occurs when select 1 changes
        $("#select2").val($(this).val());
      });
    });
    

    You can see a working demo here

    This would set <select id="select2"> to the same value as the other one has. .val(vale) selects the <option> that has the corresponding value in the <select>, also de-selecting the previous selection. You use .val() without parameters to get the currently selected <option>‘s value.

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

Sidebar

Related Questions

I want to start learning jQuery, but there's so much you can do with
I just start learning WPF, is that possible I can create an IE toolbar
I have quite sometime now (a month or two) before I can actually start
In my learning I have always learnt and understood callbacks in jQuery like this:
I'm still learning JQuery (and as a result a little JavaScript) but I can't
I want to start learning to program for OSX but have only programmed for
Where can I start learning Windows Form designing? For example: Microsoft Zune player, Buttons,
I just installed the latest SDK from Apple so I can start learning iPhone
before i start of with anything i know that jQuery and Ajax are the
I am learning how to use JQuery to help check data availability. To start

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.