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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:30:12+00:00 2026-05-20T12:30:12+00:00

I recently posted my question see previous question and received a great working solution

  • 0

I recently posted my question see previous question and received a great working solution but when I applied the solution to my code, I found that if there was any html tags between the two selects, the second select list would not update. My guess is that the .next was not finding the class I was searching for.

<cfloop query="rsRequestSystems">
<tr>
    <td><select class="platform" name="platform" id="platform">
            <option></option>
            <cfloop query="rsPlatform">
                <option value="#rsPlatform.optionValue#" <cfif rsRequestSystems.platform eq rsPlatform.optionValue>selected</cfif>>#rsPlatform.optionDesc#</option>
            </cfloop>
        </select></td>
    <td><select name="model" id="model">
            <option></option>
            <cfloop query="rsModels">
                <option value="#rsModels.optionValue#" <cfif rsRequestSystems.model eq rsModels.optionValue>selected</cfif>>#rsModels.optionDesc#</option>
            </cfloop>
        </select></td>
</tr>

and the jQuery code is:

$(".platform").live("change", function() {
    var firstOption = $(this);
    $.getJSON("index.cfm?do=misc.getModels",{platform: $(this).val()},      
    function(j){
        var options = '';
        for (var i = 0; i < j.length; i++) 
            {
                options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
            }
    firstOption.next("#model").html(options);
    });
});

and here is a sample of the json data being returned:

[{"optionValue":"", "optionDisplay":"Select Model"},]
  • 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-20T12:30:13+00:00Added an answer on May 20, 2026 at 12:30 pm

    IDs have to be unique. As your code represents a table row, I assume other rows look similar. If this is the case, use classes instead.
    But if these are really the only elements with this IDs you can simply use:

    $('#model').html(options);
    

    next only selects the next sibling if it matches the selector. Based on your HTML, you could do:

    firstOption.parent().next().children('select').html(options);
    

    Actually, your code should not work as you add the live handler to elements with class platform, not ID. Maybe a typo?

    Assuming your elements have classes instead of IDs, you can also do:

    firstOption.closest('tr').find('.model').html(options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently posted this question on the r-help mailing list but got no answers,
Please See Correct Answer for solution to the requested question. Hi, Recently I have
I recently posted a question about a WCF Restful web service that I am
Recently posted a question regarding the HttpClient over Https ( found here ). I've
I recently posted a question about Azure... is it really an OS? I understand
Recently this question was posted about the definition of what a transaction is in
This question could be posted on ServerFault as well, however there is definitely a
Is there an easy way to sort sphinx results? Recently posted (by dates) Highest
I recently seen a flash game application that posted a score to a db
I recently posted this question which worked locally with the answer I selected as

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.