Saturday, October 1, 2011

css(Map)

css(Map properties) returns jQuery
Set a key/value object as style properties to all matched elements. This serves as the best way to set a large number of style properties on all matched elements.

Example:

Sets color and background styles to all p elements.
$("p").css({ color: "red", background: "blue" });

HTML:
<p>Test Paragraph.</p>

Result:
<p style="color:red; background:blue;">Test Paragraph.</p>

No comments:

Post a Comment