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″.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.