Jquery Css()

jQuery - css() Method


jQuery css() Method

The css() method sets or returns 1 or to a greater extent than manner properties for the selected elements.

Return a CSS Property

To supply the value of a specified CSS property, purpose the next syntax:
css("propertyname");
The next instance volition supply the background-color value of the FIRST matched element:

Example

$("p").css("background-color");

Set a CSS Property

To ready a specified CSS property, purpose the next syntax:
css("propertyname","value");
The next instance volition ready the background-color value for ALL matched elements:

Example

$("p").css("background-color", "yellow");

Set Multiple CSS Properties

To ready multiple CSS properties, purpose the next syntax:
css({"propertyname":"value","propertyname":"value",...});
The next instance volition ready a background-color in addition to a font-size for ALL matched elements:

Example

$("p").css({"background-color": "yellow", "font-size": "200%"});

     

Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?