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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:39+00:00 2026-06-17T12:18:39+00:00

My problem is how to change an options color (or disable) within a second

  • 0

My problem is “how to change an options color (or disable) within a second drop down list depending on a first selection?” with javascript / jquery.

For example: If selected “13 Stairs” in my first drop down list 14 and 15 Stairs should have color “red” (or disabled) in the second drop down.

Something like “if option==13 Stairs* -> 14* / 15* == disabled” or
“if selected value “a” -> value “m-r” = red.”

Perhaps its very easy, but I’m a completly nood in Javascript. 🙁
Hopefully someone can hep me.

<form id="test" name="test" method="post" action="">
    <label for="demo"></label>
    <select name="first-election" id="first-election">
      <option value="a">13 Stairs - 001</option>
      <option value="b">13 Stairs - 002</option>
      <option value="c">13 Stairs - 003</option>
      <option value="d">14 Stairs - 001</option>
      <option value="e">14 Stairs - 002</option>
      <option value="f">14 Stairs - 003</option>
      <option value="g">15 Stairs - 001</option>
      <option value="h">15 Stairs - 002</option>
      <option value="i">15 Stairs - 003</option>
    </select>
<br /><br />
    <select name="color" id="color">
      <option value="j">13 Stairs - green</option>
      <option value="k">13 Stairs - yellow</option>
      <option value="l">13 Stairs - black</option>
      <option value="m">14 Stairs - green</option>
      <option value="n">14 Stairs - yellow</option>
      <option value="o">14 Stairs - black</option>
      <option value="p">15 Stairs - green</option>
      <option value="q">15 Stairs - yellow</option>
      <option value="r">15 Stairs - black</option>
    </select>
</form>
  • 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-17T12:18:40+00:00Added an answer on June 17, 2026 at 12:18 pm

    Here’s how to disable the options:

    var $options = $('#color').find('option');
    
    $('#first-election').change(function () {
    
        var num = parseInt( $('option:selected', this).text(), 10 );
    
        $options.prop('disabled', false).filter(function () {
            return $.text(this).indexOf(num) !== 0;
        }).prop('disabled', true);
    
    }).change();
    

    Here’s the fiddle: http://jsfiddle.net/Gp7fF/

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

Sidebar

Related Questions

I want jQuery to change the color of some of my multi-select list's options
I am facing background color change problem while using jquery. When the page loads
So I can change the color of a options menu item no problem. However,
I have problem to change the border color of the visited thumbnails using Galleriffic.
I'm having a problem getting a change event to register with the following code:
I implemented the table sorter yesterday and i have a problem trying to change
I have problem with c# script who change user AD password, when try change
Hey here is my problem : i made a flash and i can`t change
I have a problem to dismiss my progbar and to change to view that
I had a problem that was making the original array to change, the curious

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.