Home >Web Front-end >JS Tutorial >Example of usage of removeClass() method in jQuery_jquery
The example in this article describes the usage of the removeClass() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
This method removes one or more classes from the matching element.
According to the different method parameters, there are the following syntax structures.
Grammar structure 1:
Method has no parameters. Remove all classes from matching elements.
Example code:
The code can delete all css classes of the div.
Grammar structure 2:
Remove the specified class from the matching element
Example code:
Example 1:
Remove a specified class.
Example 2:
Remove two CSS classes, separated by spaces between class names.
Grammar structure three:
Parameter list:
Example code:
Example 1:
Use a function as a parameter, and the function returns a CSS class name to be deleted.
Example 2:
Using a function as a parameter, the function returns two CSS class names to be deleted, separated by spaces.