Home/Jquery/css() method in Jquery

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:

jquery-css-method-dotnet-helpers-com-thiyagu

SET CSS Property :

It will set CSS property for the matched element.

 

READ  .InnerWidth() method in Jquery

Output:

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

dotnet-helpers-jquery-css-method-thiyagu

Leave A Comment