jQuery - Get and set CSS classes
jQuery Manipulating CSS
jQuery has several methods for CSS manipulation. We will study the following:
addClass() - Add one or more classes to the selected element
removeClass() - Remove one or more classes from the selected element
toggleClass() - Add/delete class switching operation for selected elements
css() - Set or return style attributes
Style sheet
.important
{
font-weight:bold;
font-size:xx-large;
}
addClass() method
标题 1
标题 2
段落1
段落2
文本
You can also specify multiple classes in the addClass() method :
文本。文本。
removeClass() method
标题 1
标题 2
段落1
段落2
标题 1
标题 2
段落1
段落2