Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed jQuery Basics!
You have completed jQuery Basics!
Preview
Use jQuery methods like css(), addClass() and removeClass() to change the look of DOM elements.
A list of helpful methods for getting and setting CSS-related properties of elements.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Manipulating the CSS directly, or adding,
or removing the class of an element.
0:00
We've already seen a bit
of the CSS method.
0:00
It works like the other manipulation
methods as a getter and a setter.
0:04
The first parameter this method takes
is a CSS rule you wanna get or change.
0:08
If the second parameter is present,
0:13
the CSS method will set the value of
the CSS rule to whatever you pass in.
0:15
jQuery gives you a few options for adding
or removing classes from an element.
0:20
To add a class to an element, use the
addClass method with the name of the class
0:25
you want to apply to the element.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up