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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:49:51+00:00 2026-05-23T01:49:51+00:00

I have 4 dropdowns and when 1 is selected, I want the other 3

  • 0

I have 4 dropdowns and when 1 is selected, I want the other 3 to reset to the first option in the dropdown. I have the code below and it doesn’t work.

$(document).ready(function() {

            $('select').change(function() {

                var current = $(this).attr('id');

                $('select').each(function() {

                    if(!$(this).attr('id') == current) {
                        $('select option:eq(0)').attr('selected', true);
                    }
                });
            }); 
        });

    <h:selectOneMenu value="#{selectCategory.currentCategory}"
        valueChangeListener="#{selectCategory.valueChanged}" id="menu2">
        <f:selectItems value="#{selectCategory.national}" />
        <a4j:ajax event="valueChange" execute="@this"
            oncomplete="loadDataAndCreateChart()" />
    </h:selectOneMenu>

    <h:selectOneMenu value="#{selectCategory.currentCategory}"
        valueChangeListener="#{selectCategory.valueChanged}" id="menu3">
        <f:selectItems value="#{selectCategory.industry}" />
        <a4j:ajax event="valueChange" execute="@this"
            oncomplete="loadDataAndCreateChart()" />
    </h:selectOneMenu>

    <h:selectOneMenu value="#{selectCategory.currentCategory}"
        valueChangeListener="#{selectCategory.valueChanged}" id="menu4">
        <f:selectItems value="#{selectCategory.mayo}" />
        <a4j:ajax event="valueChange" execute="@this"
            oncomplete="loadDataAndCreateChart()" />
    </h:selectOneMenu>

equals to

<select id="menu1" name="menu1" size="1" onchange="RichFaces.ajax(this,event,{&quot;sourceId&quot;:&quot;menu1&quot;,&quot;parameters&quot;:{&quot;javax.faces.behavior.event&quot;:&quot;valueChange&quot;} } )">  <option value="1" selected="selected">1</option>
    <option value="2">2</option>
    <option value="3">3Grant</option>

    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
</select><select id="menu2" name="menu2" size="1" onchange="RichFaces.ajax(this,event,{&quot;sourceId&quot;:&quot;menu2&quot;,&quot;parameters&quot;:{&quot;javax.faces.behavior.event&quot;:&quot;valueChange&quot;} } )"> <option value="1" selected="selected">1</option>
    <option value="2">2</option>
    <option value="3">3</option>

</select><select id="menu3" name="menu3" size="1" onchange="RichFaces.ajax(this,event,{&quot;sourceId&quot;:&quot;menu3&quot;,&quot;parameters&quot;:{&quot;javax.faces.behavior.event&quot;:&quot;valueChange&quot;} } )"> <option value="1" selected="selected">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
</select><select id="menu4" name="menu4" size="1" onchange="RichFaces.ajax(this,event,{&quot;sourceId&quot;:&quot;menu4&quot;,&quot;parameters&quot;:{&quot;javax.faces.behavior.event&quot;:&quot;valueChange&quot;} } )"> <option value="1" selected="selected">1</option>
    <option value="2">2</option>
    <option value="3">3</option>

</select>
  • 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-23T01:49:52+00:00Added an answer on May 23, 2026 at 1:49 am

    My first thought is that something like the following should work (though it is, as yet, untested):

    $(document).ready(
        function(){
            $('select').change(
                function(){
                    $('select').not($(this)).find('option:first-child').attr('selected',true);
                })
         });
    

    JS Fiddle demo.

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

Sidebar

Related Questions

I have a form with 4 dropdowns on it. The default selected option in
I have following asp.net code but it gives error when I change dropdown selected
I have two dropdowns in extjs,based on the first dropdwon,the second dropdown populates.This is
I have the following dropdown list box: <select name=DDLConditional1 size=1> <option selected=selected>is equal to</option>
I have 2 dropdowns 1 with weeknumbers 1 with years. I want to extract
I have created a populated dropdown list in HTML. When the two dropdowns have
I have a dropdown field and its value is pre-selected as soon as its
I have a web page consisting of a dropdown menu. What i want is
I have a form with 3 dropdowns that I want to toggle the disabled
This is my code so far: http://jsfiddle.net/zY3xx/ I have a blank option in all

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.