☰
👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

jquery check if has clas

The jQuery .hasClass() method checks if at least one of the selected elements have a given class name:

<div id="myId" class="selected"></div>

// true
$('#myId').hasClass('selected')

// false
$('#myId').hasClass('non-existing')

More