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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:15:43+00:00 2026-05-10T15:15:43+00:00

Help! I am using jQuery to make an AJAX call to fill in a

  • 0

Help! I am using jQuery to make an AJAX call to fill in a drop-down dynamically given the user’s previous input (from another drop-down, that is filled server-side). In all other browsers aside from Firefox (IE6/7, Opera, Safari), my append call actually appends the information below my existing option – ‘Select An ‘. But in Firefox, it automatically selects the last item given to the select control, regardless of whether I specify the JQuery action to .append or to replace (.html()).

<select name='Products' id='Products' onchange='getHeadings(this.value);'>   <option value=''>Select Product</option> </select>      function getProducts(Category) {   $.ajax({     type: 'GET',     url: 'getInfo.cfm',     data: 'Action=getProducts&Category=' + Category,     success: function(result){       $('#Products').html(result);     }   }); }; 

Any thoughts? I have tried in the past to also transmit another blank first option, and then trigger a JavaScript option to re-select the first index, but this triggers the onChange event in my code, rather annoying for the user.


Update:

Here’s an example of what the script would return

<option value='3'>Option 1</option> <option value='4'>Option 2</option> <option value='6'>Option 3</option> 

Optionally, if using the .html() method instead of the .append(), I would put another

<option value=''>Select a Product</option> 

at the top of the result.


@Darryl Hein

Here’s an example of what the script would return

<option value='3'>Option 1</option> <option value='4'>Option 2</option> <option value='6'>Option 3</option> 

Optionally, if using the .html() method instead of the .append(), I would put another

<option value=''>Select a Product</option> 

at the top of the result.

  • 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. 2026-05-10T15:15:44+00:00Added an answer on May 10, 2026 at 3:15 pm

    Can you just change your success function to reset the selected item to the first option?

    $('#Products').append(result).selectedIndex = 0; 

    or to set it to the previous selection?

    var tmpIdx = $('#Products').selectedIndex; $('#Products').append(result).selectedIndex = tmpIdx; 

    If the onChange event should not fire then you can always set a flag to indicate that the form is updating and change events can check for that flag and exit if it is set.

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

Sidebar

Related Questions

I am using jquery's .post ajax call to pull an form input value and
I make an AJAX request like so using JQuery: $.ajax({ type: GET, url: getvideo.php,
Am I missing something? I'm trying to do a simple ajax call using jquery
i'm trying to make my image search with google ajax search i'm using jQuery.
I make an AJAX call to a PHP script like so: function convertNow(validURL){ $.ajax({
I hope you can help me with this. I've been using jquery datepicker in
I am trying to dynamically filter out content using checkboxes and jquery. Being new
After using them a while I can't help but feel that the hoops you're
I have heard using PDB files can help diagnose where a crash occurred. My
My team is using FxCop to help clean up an existing ASP.NET application. We

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.