$("#confirm_text").text("Are you sure you want " +this.name +" "+ this.type +"?");
整个短语是白色的,但我想让this.name 和this.type 变成橙色。 JS 方法 fontcolor 不起作用。有什么办法吗?
最佳答案
试试这个:
"Are you sure you want <span style='color: orange'>" +this.name +" "+ this.type +"</span> ?"
在这里你可以看到演示:http://jsfiddle.net/2pRzX/
关于javascript - 如何将 css 规则应用于 Javascript 表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19656409/