我有一个输入框,我需要在其中设置动态输入的文本的颜色。我无法使用 content.style.color
属性设置颜色。这是 fiddle for highlighting word in input box
最佳答案
更改 content.style.color = 'red';
到 text.style.color = 'red';
您想在元素上设置样式,而不是元素的值。
关于javascript - 如何在输入框javascript中设置文本颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43460302/