Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGolas Makefs
Full Stack JavaScript Techdegree Student 285 Pointselement and elements
so to make it clear when we type elements and when element?
Is elements for multiple things we want to target or it would not be working if we don't add s behind element for getElementsByTagName, getElementsByClassName.
Is S only for class and TagName?
1 Answer
Steven Parker
231,248 PointsSome functions return just one element, others return a collection of elements. The "s" in the function name will reflect that, and there will be only one correct spelling for each function. For examples:
-
getElementByID
(no "s") returns only one element -
getElementsByName
(with "s") returns a collection