Why is document.getElementById('tableId')[removed] not working in IE8?

前端 未结 8 2082
迷失自我
迷失自我 2020-12-01 14:17

I modify document.getElementById(\'\').innerHTML with Java Script in a page. It\'s working fine in Firefox, but not IE8. Please see below for more details:

8条回答
  •  庸人自扰
    2020-12-01 14:35

    On another StackOverflow question I found a link to a blog post written by the guy who implemented that part of the Trident engine. It is a design flaw (due to lack of time and backward compatibility issues) that was never fixed. You can read his notes (including his personal workaround) here.

    However, to fix it on my project, since I was already using jQuery, I just used jQuery's .html() function.

    // OLD 
    localRows[cIndex].innerHTML = '
    Test Div
    '; // FIXED $(localRows[cIndex]).html('
    Test Div
    ');

提交回复
热议问题