A jQuery CSS class sets the following:
.newwidget { border: 1px solid #5a9ee9; background: #5a9ee9 url(t6.gif) 50% 50% repeat-x; color: #ffffff; font-weight: bold; text-transform: uppercase; padding:3px 3px 3px 10px; font-size:10px}
How can this class be overridden and a new class added so that I can put different styles in it? Maybe I have to remove before classes before adding them. How is this done?
Thanks
Use the class selector with addClass and removeClass.
$('.newwidget').removeClass('newwidget').addClass('newerwidget');
I think it's worth noting that you can remove all the classes by leaving off the parameter from removeClass()
:
$('.newwidget').removeClass().addClass('newerwidget');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With