0

In my HTML view page, I have written this on the section

 <div class="stats-small__data">
   <span class="stats-small__percentage stats-small__percentage--" id="SatisPrecent"></span>
 </div>

Also, I created an ajax result to get value from the controller, and depending on that I want to add increase to the end of stats-small__percentage stats-small__percentage--

What I did was

 if (data.SatisAva > 50) {
   document.getElementById("SatisPrecent").className = "increase";
 } else {
   document.getElementById("SatisPrecent").className = "decrease";
 }

But it didn't work. Can any one help me on this please?

Dev Beginner
  • 589
  • 1
  • 11
  • Instead of `className` you can try using `classList.add` and `classList.remove`. – Kuba Pawlak May 06 '22 at 08:27
  • the problem to me doesnt lay on using className... that's correct despite not being usually the preferred strategy. I think something is missing in the question. It says something didn't work but there's not enough information here to find out – Diego D May 06 '22 at 08:28

0 Answers0