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
Find the example.

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


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


First color
Second color.

Third Color

©2023 concretepage.com | Privacy Policy | Contact Us