Easy Tutorial
❮ Sel Nthchild Html Clone ❯

jQuery hasClass() Method

jQuery HTML/CSS Methods

Example

Check if a <p> element contains the "intro" class:


Definition and Usage

The hasClass() method checks if the selected element contains the specified class name.

If the selected element contains the specified class, this method returns "true".


Syntax

Parameter Description
classname Required. Specifies the class to look for in the selected element.

jQuery HTML/CSS Methods

❮ Sel Nthchild Html Clone ❯