You can use jQuery’s css() method to add new CSS properties to an item or change the values of existing properties dynamically using jQuery.
Set a single CSS property:
$('#myDiv').css('background-color', 'yellow');
Set multiple CSS properties:
$('#myDiv').css({
'background-color': 'red',
'width': '400px'
});
Add or remove a CSS class:
Add a class:
$('#myDiv').addClass('highlight');
Remove a class:
$('#myDiv').removeClass('highlight');
Toggle a CSS class:
$('#myDiv').toggleClass('active');