'innerText' works in IE, but not in Firefox

前端 未结 15 1762
执念已碎
执念已碎 2020-11-21 05:01

I have some JavaScript code that works in IE containing the following:

myElement.innerText = \"foo\";

However, it seems that the \'innerTex

15条回答
  •  花落未央
    2020-11-21 05:41

    As in 2016 from Firefox v45, innerText works on firefox, take a look at its support: http://caniuse.com/#search=innerText

    If you want it to work on previous versions of Firefox, you can use textContent, which has better support on Firefox but worse on older IE versions: http://caniuse.com/#search=textContent

提交回复
热议问题