在Firefox中使用Javascript动态更改Bootstrap 3.0徽章文本

Dynamically change Bootstrap 3.0 badge text using Javascript in Firefox

本文关键字:Bootstrap 文本 徽章 动态 Firefox Javascript      更新时间:2023-09-26

我有一个简单的javascript代码,它可以更改作为span的徽章的innerText。这在IE中运行良好,但在firefox中则不然。

https://jsfiddle.net/5z1426w2/

我所做的就是设置innerText

document.getElementById('myBadge').innerText = "TESTING"

有什么想法让这个在firefox上工作吗?

document.getElementById('myBadge').innerHTML = "TESTING"

innerText实际上不是标准的(http://perfectionkills.com/the-poor-misunderstood-innerText/)

Firefox基本上是唯一不支持它的主流浏览器

在您的示例中,innerHTML似乎会起作用。

CCD_ 3也可以工作。