How to add or remove 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’);
BY Best Interview Question ON 12 Jun 2019