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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:53:20+00:00 2026-05-27T16:53:20+00:00

I have 3 listboxes which displays same options. I want to disable the option

  • 0

I have 3 listboxes which displays same options. I want to disable the option in other two listboxes which is selected in a listbox. I want to let my User go any listbox first. Any help is appreciated.

  • 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-27T16:53:21+00:00Added an answer on May 27, 2026 at 4:53 pm

    If you have the following HTML:

    <select id="select1">
        <option value="">Choose</option>
        <option value="1">One</option>
        <option value="2">Two</option>
        <option value="3">Three</option>
        <option value="4">Four</option>
    </select>
    
    <select id="select2">
        <option value="">Choose</option>
        <option value="1">One</option>
        <option value="2">Two</option>
        <option value="3">Three</option>
        <option value="4">Four</option>
    </select>
    
    <select id="select3">
        <option value="">Choose</option>
        <option value="1">One</option>
        <option value="2">Two</option>
        <option value="3">Three</option>
        <option value="4">Four</option>
    </select>
    

    You can do this (with the help of jquery):

    var previousValues = []
        $selects = $('#select1, #select2, #select3');
    
    $selects
        .mousedown(function(e) {
            // save the previous value for re-enabling it when you change
            var val = $(this).val();
            if (val) {
                previousValues[this.id] = val;
            }
        })
        .change(function(e) {
            // get the other select elements
            var $theOtherSelects = $selects.not('#' + this.id),
                prevVal = previousValues[this.id],
                val = $(this).val();
    
            // re-enable the previously disabled option
            if (prevVal) {
                $theOtherSelects
                    .find('option[value=' + prevVal + ']')
                    .prop('disabled', false);
            }
    
            // if a value is selected, disble in the other selects            
            if (val) {
                $theOtherSelects
                    .find('option[value=' + val + ']')
                    .prop('disabled', true);
            }
        })
        .mousedown()
        .change();
    

    Here’s jsfiddle for you to play with.

    Note: I’ve used jQuery because it is much easier, will work cross-browser, and you did not specify you didn’t want to use it explicitly.

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

Sidebar

Related Questions

I have a ListBox which displays items of variable height. I want to show
I have an asp page in which the are number of listboxes.I want to
I have a databound listbox which is actually displaying two columns of data. It
I have a WPF listbox which displays messages. It contains an avatar on the
I have two separate binding problems with listboxes with an itemtemplate which contains a
I have a ListBox which displays the collection of MyObjects. The collection is in
I have a form which I want the user to be able to export
I have a ListBox which happily displays data using a code-behind MVVM object. However,
I have a listbox which has two buttons to control the priority of the
I have a listbox which displays the contents of an array. The array is

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.