Home  >  jQuery

Example of Element Selector in jQuery

May 03, 2013
Element Selector in jQuery selects the element by tag name. After selecting the entire element by specified tag is stored in collection and can be used for any purpose. Syntax is
("element")
 
If we want to select all div tag, then we need to do like ("div"). Find the example.

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>

<div>Paragraph one</div>
<span>Span one</span>

<div>Paragraph two</div>
<span>Span two</span>

<script>$("div").css("color","red");</script>
<script>$("span").css("color","blue");</script> 
</body>
</html>
 

Output
Paragraph one
Span one
Paragraph two
Span two
FIND MORE TUTORILAS


©2019 concretepage.com | Privacy Policy | Contact Us