.hasClass() Method

Syntax

$(selector).hasClass(class)

Description

".hasClass()" method is used to check the existence of a specified css class in the selected element. Returns 'true' when the condition is matched else returns 'false'. The below example checks for the specified css class in the paragraph element.

Example Code

Result:


Welcome to Hscripts.com

Hscripts is praised as best free webmaster resources online, by our users.

Free website content that help to develop, build, promote and maintain a web site.




Ask Questions

Ask Question