Home  >  jQuery

Example of Class Selector in jQuery

April 28, 2013
Class Selector works on class. Class Selector selects the class and applies the other jQuery functionality as required. Find the syntax of Class Selector.
$(".className")
 
We need to start with (.) and then any class name. Find the example.

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<div class="simple"> Hi All</div>
<div class="colored">This is jQuery Demo.</div>
<div class="simple"> Learn jQuery with Example.</div>
<span class="colored">We will learn class selector here</span>
<script>$(".colored").css("color","blue");</script>
</body>
</html>
 

Output
Hi All
This is jQuery Demo.
Learn jQuery with Example.
We will learn class selector here
FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us