Home >>jQuery Tutorial >jQuery hasClass() Method

jQuery hasClass() Method

jQuery hasClass() Method

jQuery hasClass() method is used to checks if any of the selected elements have a specified class name. It return "true" if the.


Parameter Values

Parameter Description
classname It is a required parameter and is used to Specifies the class name to search in the selected elements
Here is an Example of jQuery hasClass() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
.phptpoint {
font-size: 120%;
color: blue;
<p class="phptpoint">This is a phptpoint.</p>
<p>Hello world</p>
<button class="btn1">click me to check class</button>



This is a phptpoint.

Hello world