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:
function showProgressMessage(e) { $('#progress').removeClass('red-text').html(e); } showProgressMessage(fileName + ": Loading: " + Math.floor(100 * cnt / end) + "%");
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.
showProgressMessage(fileName + ": Loading: <span style='color: green;'>" + Math.floor(100 * cnt / end) + "%</span>");