Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Dskellth theFirst
Courses Plus Student 66 PointsWhy does he write LI instead of li?
can you explain me why he typed LI in stead of li?
1 Answer

Steve Hunter
57,682 PointsHi there,
The tagName
method returns the name of the tag in capital letters when used on an HTML DOM. For an XML DOM tree it returns the tag name as typed. Documentation
Steve.
Dskellth theFirst
Courses Plus Student 66 PointsDskellth theFirst
Courses Plus Student 66 PointsDo you know why?
Steve Hunter
57,682 PointsSteve Hunter
57,682 PointsNo idea - sorry!
Dskellth theFirst
Courses Plus Student 66 PointsDskellth theFirst
Courses Plus Student 66 Pointsso i just have to always type that in caps lock?
Steve Hunter
57,682 PointsSteve Hunter
57,682 PointsYep - you need to compare it to the uppercase version of the HTML tag, without the angle brackets. So
<li>
is returned bytagName
as a string of"LI"
, a<div>
is returned as"DIV"
etc.Dskellth theFirst
Courses Plus Student 66 PointsDskellth theFirst
Courses Plus Student 66 Pointsbut can i write in lower case if i do == instead of === ?
Steve Hunter
57,682 PointsSteve Hunter
57,682 PointsNot sure - try it and see if it works!
Dskellth theFirst
Courses Plus Student 66 PointsDskellth theFirst
Courses Plus Student 66 Pointsehh, dont have time
James Estrada
Full Stack JavaScript Techdegree Student 25,862 PointsJames Estrada
Full Stack JavaScript Techdegree Student 25,862 Points@Dskellth that's not how you learn...
Manuel Padilla
Courses Plus Student 6,854 PointsManuel Padilla
Courses Plus Student 6,854 PointsIt doesn't matter. I tried using strictly equals (===) with lower case 'li'. Still doesn't work. The returned tag name is always in the canonical uppercase form.