changing text color
-
Hello,
I have a scenario where, when the total percentage is 100 the text should be green in color and when the total percentage is above 100 the text should be red and when the total percentage is below 100 the text should be orange. I have tried including 3 “html content” with 3 separate colors for each condition but that approach looks messy. So I just need to know if it possible to change the color of the div element from calculated field for each condition.
code i have in html content:
<div id="result" style="color:#FF0000; text-align:left; font-weight:600; font-size:15px;"></div>
code i have in a calculated field:
(function(){ if(fieldname22 > 100) { jQuery('#result').html('Total Percentage: '+fieldname22+'% (red)'); } else if (fieldname22 < 100) { jQuery('#result').html('Total Percentage: '+fieldname22+'% (orange)'); } else if (fieldname22 == 100) { jQuery('#result').html('Total Percentage: '+fieldname22+'% (green)'); } })()
Thanks in advance.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘changing text color’ is closed to new replies.