jQuery Tutorial

jQuery hasClass() Method With Syntax and Example

What is hasClass method in jQuery?

The hasClass() method determines whether any selected elements belong to a specific class.

This method will return "true" if any selected elements have the specified class name.

Syntax of hasClass method in jQuery


Example of jQuery hasClass method

Check if any element has a class named "intro":

Did you find this article helpful?