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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:18:36+00:00 2026-06-12T11:18:36+00:00

I have 3 <select> menus, each with change events working on them. Break down

  • 0

I have 3 <select> menus, each with change events working on them. Break down of the code looks like this:

$(document).ready(function(){
    // some code

    $("#selectOne").change(function() {
        // some code inc ajax request

        $("#selectTwo").change(function() {
            // some code inc a different ajax request
        });

        $("#selectThree").change(function() {
            // some code inc a yet another ajax request

        });
    });
});

The problem with the above is that, while selectOne works fine, and selectTwo seems to work fine also, if I change selectThree, the code for both selectTwo AND selectThree fires at the same time. Depending on the sequence of selection of any of the 3 selects, the response of selectThree.change can be to display and hide each of the previous responses, before settling on displaying an incorrect response.

What I’d like to do is this:

$(document).ready(function(){
    // some code

    $("#selectOne").change(function() {
        // some code inc ajax request
    });

    $("#selectTwo").change(function() {
        // some code inc a different ajax request
    });

    $("#selectThree").change(function() {
        // some code inc a yet another ajax request

    });
});

In this scenario, selectOne works fine, but selectTwo and selectThree don’t respond to change.

Is there a way of correcting any of this, so that as each element is changed, only the correct change event is fired?

  • 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-12T11:18:37+00:00Added an answer on June 12, 2026 at 11:18 am

    It seems that when your document is loaded there is no select elements with id “selectTwo” or “selectThree”. Similarly in the first case, there is no “selectThree” when the eventhandler of “selectOne” executes. That’s why the corresponding event handlers does not execute. There is two way you can handle this proplem.

    1 – Assing handlers when the elements are created.

    2 – Use .on() instead of .change():

    $('body').on("change", "#selectOne", function () {});
    
    $('body').on("change", "#selectTwo", function () {});
    
    $('body').on("change", "#selectThree", function () {});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implenmented drop-down lists Select menus in jQuery Mobile. <div data-role=fieldcontain> <label for=name
I have two select menus (#id1 and #id2) that, when validated as containing a
i have a 2 types of select list menus: <select name=category> <option>----Select----</option> <option>Category 1</option>
I have a SELECT LIST MENU containing products and on this menu i use
I have 2 drop-down menus (select1 and select2) and 1 input text (rate). When
I have a select that I'd like to use the custom menu display (rather
I have a full list of timezones in a select menu like so: <option
I have a jQuery code which will create select from a ul li menu
I have 10 dropdown menus, each with 30 or so options. I'm trying to
I have this JavaScript function that highlight table TD's when clicked on each individual

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.