Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting innerHTML with JQuerys html() method in IE 8 not working
    primarykey
    data
    text
    <p>I have </p> <pre><code>$('#structure').html(html); </code></pre> <p>This works fine in FireFox. IE 8 doesn't display the html. I also tried it with simple text eg.</p> <pre><code>$('#structure').html("Test"); </code></pre> <p>or</p> <pre><code>$('#structure').html("&lt;h3&gt;Test&lt;/h3&gt;"); </code></pre> <p>All does nto work with IE 8 but in firefox. So I don't think it is a problem with invalid html.</p> <p>if I replace this with </p> <pre><code>document.write(html); </code></pre> <p>IE correctly displays the content.</p> <p>I'm lost. I also tried getElementById and setting innerHTML property or .empty and append. Basically everything i tried worked in FF, nothing in IE 8.</p> <p>Code runs in a .change() event which is correctly executed also in IE.</p> <p>Any Ideas?</p> <p>EDIT:</p> <p>html is returned by a 3rd party commercial plugin. It returns browser specific code for displaying an ActiveX component (IE) or a plugin (FF). The returned html works. This is not the only place I use this.</p> <p>Maybe you can't asyonchronously load ActiveX? that would explain everything.</p> <pre><code>$(document).ready(function() { $('#ID').change(function() { var value = $(this).val(); getStructure(value); }); }); function getStructure(id){ $.get( 'getStructure.php?id=' + id, function(data){ // 3rd party function call: var html = getObjectTag(182, 172, data.Structure); // data["Structure"] does not work too in IE, it does in FF // alert(html); // is displayed also in IE when uncommented $('#structure').html(html); // alert(html); // is displayed also in IE when uncommented }, "json" ); } &lt;div class="cssform"&gt; &lt;div&gt;&lt;label&gt;ID&lt;/label&gt;&lt;input id="ID" type="text"/&gt;&lt;/div&gt; &lt;/div &lt;div id="structure"&gt;&lt;/div&gt; </code></pre> <p>Note that in another application i use:</p> <pre><code>var html = getObjectTag(182, 172, aData[0]); $('td:eq(0)', nRow).html(html); </code></pre> <p>where aData is an array parameter of the calling function. This is used to display the object in the jquery plugin datatables and here ti works for IE 8 and FF without any issues.</p> <p>EDIT2:</p> <p>Further "analysis" makes me believe that the div with id=structure is not found in IE correctly for whatever reasons.</p> <pre><code>document.getElementById("structure").innerHTML = html; </code></pre> <p>results in the error "document.getElementById(...)" is null or not an object. using jquery the selector probably returns nothing and hence nothing further is done and no error occurs. Question is, why the element is not found? Makes no sense to me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload