At first, I apologize for such a basic question, but I’m really new to javascript and I needed to change the color of a script’s loading percentage.
The script snippet is this one:
JavaScript
x
6
1
function showProgressMessage(e) {
2
$('#progress').removeClass('red-text').html(e);
3
}
4
5
showProgressMessage(fileName + ": Loading: " + Math.floor(100 * cnt / end) + "%");
6
How do I change the color of Math.floor(100 * cnt / end) + "%"
?
Advertisement
Answer
You can wrap that part of the text inside a <span>
that has its CSS color property set.
JavaScript
1
3
1
showProgressMessage(fileName + ": Loading: <span style='color: green;'>"
2
+ Math.floor(100 * cnt / end) + "%</span>");
3