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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:51:05+00:00 2026-05-29T20:51:05+00:00

Using jquery 1.7.1, I’m using json to populate the dropdown. The code works just

  • 0

Using jquery 1.7.1, I’m using json to populate the dropdown. The code works just great and is is stored in a function but called upon document.ready(). I hope someone finds it useful, BUT:

proxy.invoke("fetchCHAA", {},
        function(result) {

            if (result == null) {
                alert("Possible error in fetching list of CHAAs");
                return;
            }
            else {

                var optionsValues = '<select>';
                optionsValues += '<option value=""></option>';
                $.each(result, function() {
                    optionsValues += '<option value="' + this.chaa_id + '">' + this.chaa_name + '</option>';
                });
                optionsValues += '</select>';
                var options = $('#optionsChaa');

                options.replaceWith(optionsValues);


            }


        }, onPageError);

As I said, the problem lies with .change event or even attempting to get the value of the selected item. For example, we know that

var id = $("#optionsChaa").val();
// should bring back the chaa_id

Or:

var text = $("#optionsChaa").text();
// should bring back the chaa name

The problem is that bringing back the ID or TEXT through .val() is always undefined. I’ve noticed that others seem to have the same problem yet seemingly unable to address it.

I even added the change event to the optionsValue object hoping that it will work after the DOM is loaded but that does not seem to work as well.

I don’t want to hard code the list of options on the page but it looks like I might have to.

  • 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-29T20:51:07+00:00Added an answer on May 29, 2026 at 8:51 pm

    Try changing var optionsValues = '<select>'; to var optionsValues = '<select id="optionsChaa">';

    The ID is getting lost I think.

    edit @David M beat me to it, that’s the answer.

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

Sidebar

Related Questions

using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using jquery.load() to replace the content of a div everything works great, however there
Using jquery how do I focus the first element (edit field, text area, dropdown
Using jQuery, I make these changes in the DOM: $(document).ready(function() { $('.editable').click(function() { var
Using jquery I have a clicking tab mechanism that are nothing but anchor tags
Using Jquery AJAX to get a value from a PHP script. This line works
Using jQuery validation plugin but it has no CSV validation. I have made an
Using jQuery 1.7.2 $(function(){ $('#parentElem').mouseenter(function(){ $('.myElem').animate({opacity:1}, 'fast'); }).mouseleave(function(){ $('.myElem').stop().animate{opacity:0}, 'slow'); }); }); In this
Using jQuery Ajax to fetch data from local server: it works well with IE8
Using jQuery 1.5.1 Tried this block of code in: head section as well 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.