xml parsing - Jquery object innerHTML working in Firefox but not IE? -


in summary have xml string use jquery find children of specific node.

these children , values used build html select box , append webpage.

the xml

<!--- node level !-->                  <salutation restricted="no" type="dropdownbox" tooltip="select title customer" required="yes" size="6">            <value>mr</value>            <value>sir</value>            <value>mrs</value>            <value>miss</value>            <value>lord</value>        </salutation> 

the code

    function dropdownbuilder( xml, element, id ) {        // find node specific name , children        selection = $("<div>" + xml + "</div>").find(element).children();        console.log( selection );        // generate select box        var selectbox = "<select id=\"" + id + "\"> ";        ( var j = 0; j < selection.length; j++ ) {         selectbox += "<option value=\"" + selection[j].innerhtml + "\">"                 + selection[j].innerhtml + "</option>";        }        selectbox += "</select>";         // return html        return selectbox; } 

output firefox

<select id="dropdownbox1" data-hasqtip="true" aria-describedby="qtip-1">     <option value="mr">mr</option>     <option value="sir">sir</option>     <option value="mrs">mrs</option>     <option value="miss">miss</option>     <option value="lord">lord</option> </select> 

output ie

<select id="dropdownbox1" data-hasqtip="true" jquery16309410884371447445="60"/> 

in console log in ie says "log: [object object] "

i have tried changing output using .val() , .value , .data , .attr

any idea why works fine in ff not in ie?

jsfiddle

http://jsfiddle.net/ba7u6/1/

thanks

you can replace loop in code , should work :

selection.each(function(index) {     var text = $(this).text();     selectbox += "<option value=\"" + text + "\">" + text + "</option>"; }); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -