Selector: .class and .class (select element with two/multiple classes)

Here we will see how can we select the elements on our page with two classes. Its syntax is very simple: 
where class1 and class2 are the two classes. The above selector will choose all elements with class="class1" and  
Let us take an example : 
<!--program starts---> 
<p class='first'>hello</p> 
<p class='second'>how are you</p> 
<p class='first second'>This example shows how to use effects on any object having more than one class. This text will appear  
in red color</p> 
<script type='text/javascript'> 
<!--program ends--> 
Copy the above code and try to execute in the jQuery box below, you will see that the third <p> tag text will appear in red  
color. Hence the selector $(".first.second") selects the elements with class='first' and class='second'.
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments