- innerText VS textContent
FireFox supports textContent, other Browsers supports innerText
Eg:
var divId = document.getElementById('divId');
if(window.navigator.userAgent.indexOf("Firefox") >= 1){
alert(divId.textContent);
} else {
alert(divId.innerText);
}
本文介绍了innerText和textContent的区别及使用方法,特别针对FireFox浏览器使用textContent,其他浏览器则使用innerText。提供了实例代码演示如何根据不同浏览器进行选择。

被折叠的 条评论
为什么被折叠?



