I have a list of buttons with grey background, and when a button is clicked I want to change the button’s background color to blue. I have tried jQuery’s “addClass” and added a class with a different background, but it doesn’t override the elements background (which is set with a default class). I could remove the default class, but I need to keep it because it’s used to fire other events.
How can I do this (if it’s even possible this way)?
Thanks in advance!
You can use inline css, which will override defaults; or in class you add with jQuery.addClass(), use !important; i.e. .btnCool{background: red !important;}