Select Chapter ❯
jQuery Tutorial
- jQuery Introduction
- jQuery Selector
- jQuery Traversing
- jQuery Events
- jQuery Get/Set
- jQuery Add/Remove
- jQuery CSS
jQuery Effects
jQuery Ajax
jQuery CSS
jQuery CSS is used to get and set CSS styles to elements to set or get the style it uses css() property.
Syntax For Setting Single Property
css("property","value");
$("a").css("color","green");
Syntax For Setting Multiple Property
css({"property1":"value1","property2":"value2", "property3":"value3",...});
$("a").css({"color":"green","font-size":"20px"});
You can also add and remove element classes by these properties addClass(), removeClass().
jQuery addClass()
$("button").click(function(){ $("a").addClass("active"); });
jQuery removeClass()
$("button").click(function(){ $("a").removeClass("active"); });