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 trial

JavaScript

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: