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
Get and set HTML attributes with the attr() method.
References
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
Just like the text and HTML methods we
learned about in the first part of this
0:00
course, attribute changing methods
act as both getters and setters.
0:01
The attribute method gets the value
of an element's attribute, or
0:06
sets the value of an element's attribute.
0:10
Remember that an attribute
is basically any
0:13
piece of additional information
included on an HTML tag.
0:15
So an image's source is an attribute,
as is its alt text, class and
0:19
ID names are attributes, and so on.
0:24
Go ahead and
open the work space with this video,
0:26
let's use the attribute method to add an
attribute to all of the secure links, so
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