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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:23:30+00:00 2026-05-13T22:23:30+00:00

The following code failed when I upgraded to 1.4.1, and worked ok when I

  • 0

The following code failed when I upgraded to 1.4.1, and worked ok when I rolled back to 1.3.2.

var ddlCountry = $("#<%= this.ddlCountry.ClientID %>");
  if (ddlCountry.val() == "") {
    ddlCountry.val(address.country);
    ddlCountry.change();
  }

BTW the problem is that the value of the <select> list is never set.

Yes, this is all wrapped up in a $(document).ready 🙂

EDIT: For reference this is the code I used:

            ddlCountry.find("option").each(function() {
                if ($(this).text() == address.country) {
                    ddlCountry.val($(this).val());
                }
            });
  • 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-13T22:23:30+00:00Added an answer on May 13, 2026 at 10:23 pm

    If you are setting the value, this will work, in jQuery 1.4 is must be the value not text, example:

    <select id="ddlCountry">
      <option value="1">A</option>
      <option value="2">B</option>
    </select>
    

    In jQuery 1.3 this works: $("#ddlCountry").val("A")
    In 1.4 it doesn’t it must be: $("#ddlCountry").val("1")

    Alternatively if you can’t change your dropdown, you can search for and select based on text like this:

    ddlCountry.filter(function() { 
      return $(this).text() == address.country; 
    })[0].selected = true;
    

    For reference, here’s the jQuery change that happened. From the 1.4 notes:

    .val(“…”) on an option or a checkbox is no longer ambiguous (it will always select by value now, not by text value). (Commit)

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

Sidebar

Related Questions

The following code worked before, but failed to get the next 4 days of
I use the following code to handle failed requests. - (void)requestFailed:(ASIHTTPRequest *)request { [self.alertView
The following code produces a failed test, not a passing test (as I would
I've got the following code: function failureCallback($host, $port) { print memcache '$host:$port' failed; }
I get the Command Failed exception when using the following code to insert content
when i compile the following code , Conversion failed when converting datetime from character
I want to make the following code: <h2>TEXTz</h2> <p>ARTICLE</p> <h2>TEXTx</h2> <p>ARTICLE</p> Look like this:
I tried the following code with Spring 3.x which failed with BeanNotFoundException and it
When I had used following code, I got the message Failed to validate oauth
I found a problem concerning namespace search. The following simplified code failed to compile:

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.