Select Box options not visible in Internet Explorer for wordpress site

I am facing problem with the select box, options are not visible on my wordpress site. I have extracted the country name from an xml file using JavaScript and used as the options of the select box. Firefox and Chrome shows the options as required but IE does not show the options of countries. Could you please help me how can I resolve this problem and show same as Chrome and firefox dpes.

Here is my site and the code is given below :

$(function() { 
    $.get( 'ttalk.xml', {}, function(data) { 
        var optionHtml = '<option value="Please Select" selected="selected">Please Select</option>';
        $(data).find('item').each(function() {
            var _item = $(this);
            html = '<option value=' + _item.find('code').text() + '>';
            var name = _item.find('country').text();
            html += name.split('+').join(' ')+ '</option>';
            optionHtml += html; 
        });  
        $('#destinationList').html(optionHtml);
        $('#destination').html(optionHtml);
    }, 'text' ); 
});

Related posts

Leave a Reply

2 comments

  1. You may try this

    $(function() {
        var xml;
        $.get( 'ttalk.xml', {}, function(data) { 
            if ($.browser.msie)
            {
                var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.loadXML(data);
                xml = xmlDoc;
            }
            else xml = data;
    
            var optionHtml = '<option value="Please Select" selected="selected">Please Select</option>';
            $(xml).find('item').each(function() {
                var _item = $(this);
                html = '<option value=' + _item.find('code').text() + '>';
                var name = _item.find('country').text();
                html += name.split('+').join(' ')+ '</option>';
                optionHtml += html; 
            });  
            $('#destinationList').html(optionHtml);
            $('#destination').html(optionHtml);
        }, 'text' ); 
    });
    
  2. I think you may have an issue with the encoding of the xml doc.
    Web Dev toolbar is show me this error.

    While it still works in FF and Chrome, IE8 may be having extreme issues with it.

    Timestamp: 13-03-16 6:23:09 PM
    Error: XML or text declaration not at start of entity
    Source File: http://rabbitrabbitmobile.net/ttalk.xml
    Line: 2, Column: 1
    Source Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?><CHANNEL>
    

    -d