How do you add a class to an element using jQuery?
Description : Use the .addClass() method to add one or more classes to an element.
Answer :
To add a classto an element using jQuery, use the `.addClass()` method. For example,`$('#elementId').addClass('newClass');` adds the class`newClass` to the element withID`elementId`. You can also add multiple classes by separating them with spaces, such as`$('#elementId').addClass('class1 class2');`. This method modifies the element's `class` attribute to include the newclasses, allowing you to apply different styles or behaviors based on the class.