简体   繁体   中英

select drop down is expanding long in IE9

I am populating values in to select drop down using ajax call dynamically.
My code is working fine in IE8 but not in IE9. select dropdown is not appearing properly. It is exapading.

Here my snippet code:

if(xmlHttpReq.status==200)
{
    var acaComplRulesDtls=xmlHttpReq.responseText;
    //resetting individualstoApplyComplianceRules  dropdown as blank
    document.getElementById("individualstoApplyComplianceRules").innerHTML="";
    var spiltedACACompRules=acaComplRulesDtls.split("###");
    if(spiltedACACompRules.length==2){
        var indvNames=spiltedACACompRules[0];
        var indvNumbers=spiltedACACompRules[1];
        var spiltedIndvNames=indvNames.split("~~");
        var spiltedindvNumbers=indvNumbers.split("^^");
        var namelen=spiltedIndvNames.length;
        var numberlen=spiltedindvNumbers.length;
        //checking names & numbers length same or not
        if(namelen==numberlen){
            var selectField=document.getElementById("individualstoApplyComplianceRules");
            for(var i=0; i<namelen-1; i++){
                var optionField = document.createElement("OPTION");
                optionField.text = spiltedIndvNames[i];
                optionField.value = spiltedindvNumbers[i]
                selectField.options.add(optionField);
            } //for loop ends here
        }
    } //if

Can any one help me to resolve this browser compatibility issue?

Thanks in advance..

screen shot http://imageshack.com/a/img811/177/bgzy.png

I found solution. My issue is resolved. ajax response text contains many white spaces.

I removed whitespaces using replace(/^\\s+|\\s+$/g,'') java script method. now select dropdown is appearing fine.

thanks to all !!! have a great day!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM