jQuery | hasClass() with Examples
The hasClass() is an inbuilt method in jQuery which check whether the elements with the specified class name exists or not.
Parameter: It accepts a “className” parameter which specifies the class name need to search in the selected element.
Return Value: It returns true if the search is successful otherwise false.
jQuery code to show the working of this method:
Before clicking the “Click me!” button-
After clicking the “Click me!” button-