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.

JavaScript JavaScript and the DOM (Retiring) Responding to User Interaction The Event Object

Why event.target.targetName('LI') the'li' needs to be capitalized?

event.target.targetName('LI') 

Why the 'li' needs to be capitalized?

3 Answers

Bartlomiej Pajak
Bartlomiej Pajak
5,062 Points

According to MDM:

' The tagName read-only property of the Element interface returns the tag name of the element on which it's called. For example, if the element is an <img>, its tagName property is "IMG" '

I hope it helps.

But why is that? Why must it be capitalised? I understand that that is what you do, but what is the reasoning for it?