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

The Archive Base Latest Questions

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

I am having a real weird issue. I have a dropdownlist which has a

  • 0

I am having a real weird issue. I have a dropdownlist which has a certain width. I use an Ajax call to populate the dropdownlist and when the dropdownlist is populated it reduces in width. For some reason the size of the dropdownlist changes (size of the dropdownlist reduces) when it is populated with options.

JavaScript:

var serialNumberDropDownList = $("<select></select>");
    serialNumberDropDownList.attr("id","SerialNumberDropDownList_" + index);

    serialNumberDropDownList.addClass("DropDownListStyle");

    serialNumberDropDownList.append($("<option></option>").attr("value", "").text("Please select Serial Number"));


 serialNumberDropDownList.click(function() {

        if ($(this).children().length > 1) return false;        

        populateSerialNumberDropDownList();         

    });


function populateSerialNumberDropDownList() {


    $.ajax(
            {
                type: "POST",
                url: "../SomeWebService",
                dataType: "json",
                data:"{}" ,  
                contentType: "application/json",
                success: function(response) {

                    var data = JSON.parse(response.d);

                    for (i = 0; i < data.length; i++) {

                        serialNumberDropDownList.append($("<option></option>").text(data[i]).val(data[i]));
                    }

                },
                error: function(xhr) {
                    var res = eval("(" + xhr.responseText + ")");
                    alert(res.Message);
                }
            });


}

**CSS:** 

.DropDownListStyle 
{
    font-family:Verdana;
    font-size:10px;
    width:95%;
    min-width: 95%; 
}
  • 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-30T22:08:58+00:00Added an answer on May 30, 2026 at 10:08 pm

    Weirdly enough if I do the following then it works perfectly fine and it does change the width of the dropdownlist at all:

     complete: function() {
    
                    serialNumberDropDownList.removeClass("DropDownListStyle");
                    serialNumberDropDownList.addClass("DropDownListStyle");
    
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having real difficulties optimising a MySQL query. I have to use the existing
I have hit upon a real brain scorcher in C++, it has never happened
I'm having real headaches trying to work out a problem I have at the
I'm having real difficulty getting the eclipselink.join-fetch hint to work in glassfish. I have
I am having a weird issue with VS 2008 when I go to debug
I have been having real problems getting the WPF designer to work in VS
I'm having real trouble getting my head around this issue. As the title suggests,
Been having real trouble with this one and wondered if someone may have found
I am having real trouble installing SUDS in python 2.6.4. I have tried to
I'm having a very very weird issue that I'm unable to see... I tend

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.