jQuery:Selector .class

Overview

To matched the element  according to the given CSS class name.

Parameter

classStringV1.0

A class to search for. An element can have multiple classes; only one of them must match.

Demo

Description:

To find the elemets with class name ‘myClass’

HTML code:
<div class="notMe">div class="notMe"</div>
<div class="myClass">div class="myClass"</div>
<span class="myClass">span class="myClass"</span>
jQuery code:
$(".myClass");
Result:
[ <div class="myClass">div class="myClass"</div>, <span class="myClass">span class="myClass"</span> ]

Leave a Reply

Your email address will not be published. Required fields are marked *