ExampleCheck if any p element has an "intro" class:
Try it yourself » |
The hasClass() method checks if any of the selected elements have a specified class.
If ANY of the selected elements has the specified class, this method will return "true".
$(selector).hasClass(class) |
Parameter | Description |
---|---|
class | Required. Specifies the class to search for in the selected elements |