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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:27:25+00:00 2026-06-04T18:27:25+00:00

Hopefully this isn’t a repeat question, but if it is, just post the link

  • 0

Hopefully this isn’t a repeat question, but if it is, just post the link as your response.

I need to create a website with a select dropdown as the top with a few options, and several divs below with several links in them.

Depending on which option you select in the selectbox, the links that are labeled appropriately will get highlighted.

Here’s the basic structure:

<select>
  <option value="o1">Option 1</option>
  <option value="o2">Option 2</option>
  <option value="o3">Option 3</option>
  <option value="o4">Option 4</option>
</select> 

<div>
  <a href="#" class="o1">Link A</a>
  <a href="#" class="o2">Link B</a>
  <a href="#" class="o3">Link C</a>
  <a href="#" class="o4">Link D</a>
</div>

<div>
   <a href="#" class="o1">Link A</a>
   <a href="#" class="o2">Link B</a>
   <a href="#" class="o3">Link C</a>
   <a href="#" class="o4">Link D</a>
</div>

I know this process will include the .addClass() .removeClass() and .change(), I’m just not sure how to put it all together so that it works dynamically across all the divs.

Thanks in advance.

  • 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-04T18:27:27+00:00Added an answer on June 4, 2026 at 6:27 pm

    Link so:

    $('select').on('change', function(){
        var klass = this.value;
        $('.highlight').removeClass('highlight');
        $('a.'+klass).addClass('highlight');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't a very simple question, but hopefully someone has run across it. I
Hopefully this isn't a dupe of another question, but I couldn't see it anywhere
Hopefully this isn't too specific/small a question, but I was wondering if anyone knew
This isn't strictly a programming question, but hopefully someone here has the knowledge to
Hopefully this question isn't as subjective as I think it may be. I have
So I guess this isn't technically a code question, but it's something that I'm
Hopefully, despite similar question titles, this isn't a duplicate issue. I've installed ImageMagick-6.7.5-6-Q16-windows-dll.exe .
Hopefully this isn't a redundant question--I'm not really sure how to word it. Let's
Hopefully this isn't too silly of a question. In MVC there appears to be
I'm fairly new to Guice so hopefully this isn't an obvious question... I'm dealing

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.