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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:09:11+00:00 2026-06-03T19:09:11+00:00

I have 3 select boxes, all populated with the same data. Using jquery I

  • 0

I have 3 select boxes, all populated with the same data. Using jquery I would like to either a) disable the same options or b) remove the same options from the other two select boxes. I have posted the html below. You will notice I already have some headers within the select disabled, and those need to stay that way. This needs to work no matter which select box the user starts with. So if select three option 2 is picked, select 1 and 2 are disabled.

The jquery has been eluding me for hours.

edit: I forgot to add a couple things. If you change your selection, I need it to enable the previously selected option. Also, I would like the first choice ( — ) in each of the lists to always be available.

<fieldset class="fields1">
        <dl>
            <dt><label for="char_cs">test:</label></dt>
            <dd>
                <select id="char_cs1" name="char_cs1" class="char_cs">
                    <option value="">--</option>
                    <option disabled="disabled">header 1</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                    <option disabled="disabled">header 2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                    <option disabled="disabled">header 3</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                </select>
            </dd>
        </dl>
        <dl>
            <dd>
                <select id="char_cs2" name="char_cs2" class="char_cs">
                    <option value="">--</option>
                    <option disabled="disabled">header 1</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                    <option disabled="disabled">header 2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                    <option disabled="disabled">header 3</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                </select>
            </dd>
        </dl>
        <dl>
            <dd>
                <select id="char_cs3" name="char_cs3" class="char_cs">
                    <option value="">--</option>
                    <option disabled="disabled">header 1</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                    <option disabled="disabled">header 2</option>
                        <option value="3">3</option>
                            <option value="4">4</option>
                    <option disabled="disabled">header 3</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                </select>
            </dd>
        </dl>
        </fieldset>
  • 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-03T19:09:12+00:00Added an answer on June 3, 2026 at 7:09 pm

    Try this:

    $('.char_cs').change(function() {
        var ary = new Array();
        $('.char_cs option:selected').each(function() {
            if ($(this).val().length > 0) {
                ary.push($(this).val());
            }
        });
        $('.char_cs option').each(function() {
            if ($(this).val().indexOf('header')!=0) {
                if ($.inArray($(this).val(), ary) > -1) {
                    $(this).attr('disabled', 'disabled');
                } else {
                    $(this).removeAttr('disabled');
                }
            }
        });
    });​
    

    jsFiddle example.

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

Sidebar

Related Questions

I have 5 HTML select boxes that are all populated with the same data,
I have 3 select boxes and all are having same value (clones) & created
I have 4 select boxes, each containing the exact same data: Riding Fishing Smoking
I have a standard select box which I'm populating using jquery by appending options,
I have three select boxes :- select1 select2 select3 , i am fetching data
I have multiple multi-select boxes with the same class and i want to unselect
So I have two multiple select boxes like this <select id=foo multiple=multiple> <option value=1>Option
I have two multiple select boxes. I need to use JQuery to drag selected
So I have several select boxes like this: <select class=designer> <option>300</option> <option>3422</option> </select> <select
I have five select boxes .all have an first option --Select-- and i dont

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.