Home  >  jQuery

Example of .css() in jQuery

April 29, 2013
.css() applies the CSS attribute on the collection of selected DOM element. .css() can be called directly on any element and can be used with other jQuery function. Syntax is
.css(propertyName)
 
Find the example.

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<h6>First element</h6>
<h5>Second element.</h5>
<h4>Third element</h4>

<script>

$("h6").css("color", "blue");
$("h5").css("background-color", "red");
$("h4").css("border", "1px solid");

</script>
</body>
</html>
 

Output
First color
Second color.

Third Color

FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us