I have a page that can set email preferences.
Next to each email there is a "Yes/No" button (meaning is this person subscribed to this type of email).
If it is "Yes", the css class is set to bootstraps success class.
If it is "No", the css class is set to Boostrap's danger class.
I am trying to set it up so that when the user clicks this, it toggles the class and changes the html property of the button from "Yes" to "No" or vice-verse.
I use $(this).html("Yes"); and this works just fine.
However when changing the classes, I have a script that runs as:
$(this).removeClass("success");
$(this).addClass("danger");
The problem is that when I use $(this).removeClass() and also $(this).addClass(), it doesn't change the element style. However, when I query the element it DOES remove the class and does add the class I want - the only problem is that the styling does not change.
The style DOES exist in the browser. If I load an element with class="danger" or an element with a class="success" it renders exactly how it should.
So something with this removeClass and addClass is not somehow triggering the STYLE to update.
What am I doing wrong?
danger/successclasses are being overridden due to hierarchy in the CSS.