Site icon Dotnet Helpers

addClass() and removeClass()

Jquery .addClass() and .removeClass() used to add or remove CSS class dynamically in the Html element.

For Example

.addClass()

$(‘#p1′).addClass(‘cssclass1’);

Add a “cssclass1’ css class to elements that contain id of “p1″.

.removeClass()

$(‘#p1′).removeClass(‘cssclass1’);

Remove a “cssclass1’ css class from elements that contain id of “p1″.

Exit mobile version