Site icon Dotnet Helpers

css() method in Jquery

Description:

Jquery .css() method Get/set the css property for the matched elements.

Syntax

GET Property: .css( propertyName )
SET Property: .css( propertyName, value )

propertyName  A css property name
value A value to set for the property

Note :

To set multiple value, the syntax will be

.css({“propertyname”:”value”,”propertyname”:”value”,…});

GET CSS Property value :

It will return the value for specified CSS property value for the matched element

Example: 

Output:

SET CSS Property :

It will set CSS property for the matched element.

 

Output:

Clicking the button, the background-color porperty will set to the div(divBlogName) as shown below.

Exit mobile version