How we can add or remove CSS classes to an element in jQuery?

jQuery comes with two syntaxes, addClass()and,removeClass() to respectively add or remove CSS classes dynamically.


These can be used with the following syntax forms:

  • $(‘#para1’).addClass(‘highlight’);
  • $(‘#para1’).removeClass(‘highlight’);

Suggest An Answer

No suggestions avaliable!

Latest post from Jquery interview questions

Ask Question