JavaScript JavaScript and the DOM Responding to User Interaction The Event Object

Guadalupe Favela
Guadalupe Favela
Front End Web Development Techdegree Student 12,588 Points

Im a little confused about the "", Versus ""

Im still trying to understand the concept of event "bubbling" and "DOM traversal". I get really confused on when to use either pieces of code or how to apply it. Does "tagName" work similar to "document.elementsbyTagName"?

1 Answer

Steven Parker
Steven Parker
203,151 Points

Assuming "event" is the parameter to an event handler (the callback function of "addEventListener"), then:

  • is a reference to the element that generated the event
  • is the "tagName" property of that element — note that tag names are UPPER CASE

"document.getElementsByTagName()" is a function that you can use to find all the elements of a particular kind. Case is ignored so the argument should be lower case.