Web Development with jQuery®

(Elliott) #1

bapp08.indd 02/19/2015 Page 543


CSS


METHOD DESCRIPTION RETURN
VALUE

CSS

css(property) Returns the specifi ed CSS property value from
the fi rst selected element—for example:
$('div').css('background-color')

String

css(properties) Sets the specifi ed CSS properties. The
properties argument is defi ned as an object
literal of key, value pairs—for example:
$('div').css({
backgroundColor : 'red',
marginLeft : '10px'
});

jQuery

css(property, value) Sets the specifi ed CSS property value—for
example:
$('div').css('background', 'red');

jQuery

CLASS NAMES

addClass() Adds the specifi ed class name(s) to the selected
element(s). Multiple class names are separated
by spaces.

jQuery

hasClass(className) Determines whether the selected element(s)
have the specifi ed class name. This method
does not support multiple class names at the
time of this writing.

Boolean

H


continues

http://www.it-ebooks.info

Free download pdf