I did some work and couldn't make it to the working conditions.
Posting here to get some help.
In my HTML view, there is a class.
So to get some results I'm using AJAX code and in return according to the result of the JSON value, I want to change the class to another.
This is the code
<div class="stats-small__data">
<span class="stats-small__percentage" id="SatisPrecent"></span>
</div>
so this span class mainly has,
- stats-small__percentage stats-small__percentage--decrease
- stats-small__percentage stats-small__percentage--increase
I want to change with the result of ,
if (data.SatisAva > 50) {
document.getElementById("SatisPrecent").classList.add = 'stats-small__percentage--decrease';
} else {
document.getElementById("SatisPrecent").classList.add = 'stats-small__percentage--increase';
}
So the current code is not working as I wanted to.
Little help here?