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

Uche Onuekwusi
Uche Onuekwusi
17,192 Points

How come the class "remove was written in lowercase " and previously u had been writing in uppercase

javascript and the dom

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Can you please post a link to the specific video? It will be much easier to help you this way.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Uche! I'm going to post the answer here for others in case they have the same question. The question revolves around this video

In it we find the beginning of a code section that looks like this:

if (event.target.tagName == 'BUTTON') {
    if(event.target.className == 'remove') 

The question then becomes, why the button is in all uppercase and the remove is in all lower case. As you probably know, just about everything is case sensitive. In our CSS we have a class named remove so this part makes sense. But nowhere in our HTML is there anything that says BUTTON.

This is something that is being done by the browser. When you use tagName on an object, the name of the element returned will always be in uppercase. Your browser understands <button> and <BUTTON> are the same things, but when you go out and fetch the name of the element, the name will be returned in uppercase. This is described in the tagName MDN documentation.

Hope this helps! :sparkles: