Hulk Hulk - 2 months ago 11
CSS Question

How to override a class using jquery

All,

A class 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 to override this class and add a new class so that i can put different styles in it.May be i have to remove and add class.How is this done.

Thanks..

Answer

Use the class selector with addClass and removeClass.

$('.newwidget').removeClass('newwidget').addClass('newerwidget');
Comments