How to add class depending on value of number?
Hello,
I have found a piece of code that has worked for me quite nicely. But I want to see how I can have the output of the code change the class of the outputted number depending on if the number is greater than or less than 100.
The code I have is this:
- $(document).ready(function(){
- $('#div1,#div2,#div3,#div4').change(function(){
- var total = 0;
- $(#div1,#div2,#div3,#div4).each(function(){
- if($(this).val() != '')
- {
- total += parseInt($(this).val());
- }
- });
- $('#total').html(total);
- });
- })(jQuery);
So can someone help me figure out how to have the output have one class if its less than 100 and one class if its equal to 100? Also have the % sign output after the number. I would really appreciate the help. I am trying to lear but it is not coming fast. Thanks in advance.