Saturday, October 1, 2011

css(String key, String|Number value)

css(String key, String|Number value) returns jQuery
Set a single style property to a value, on all matched elements. If a number is provided, it is automatically converted into a pixel value.

Example:

Changes the color of all paragraphs to red
$("p").css("color","red");

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

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

No comments:

Post a Comment