How To Change CSS Style With jQuery
In this tutorial, we are going to see how to change CSS style with jQuery. JQuery’s .css() method can be used with CSS properties. To modify a single CSS property, the method uses two arguments: the first is the name of the desired CSS property and the second is the new value.
.css("property", "value");
If the CSS property is not already used to the object, it will add the new property and set it to the given value. If the property already exists for the object, the existing value of the property will be updated with the new value.
Example :
The following example will set the value of the background-color property for ALL matching elements (paragraphs):
$("p").css("background-color", "red");