The jQuery CSS() method is used to return the style properties of the selected elements.
Syntax-: css("propertyname");
Example of Code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".jQuery-example-Css-method-button").click(function(){
$(".jQuery-example-Css-method-paragraph").css("background-color", "grey");
});
});
</script>
<p style="background-color:red" class="jQuery-example-Css-method-paragraph">First paragraph.</p>
<p class="jQuery-example-Css-method-paragraph">Second paragraph</p>
<button class="jQuery-example-Css-method-button">click here to set the color of paragraph</button>
Output
First paragraph.
Second paragraph
