Welcome to the Treehouse Community
Looking to learn something new?
kabir kCourses Plus Student 18,036 Points
In the code,
why are we using "GlobalEventHandlers" instead of using just "Element" like this:
And how is the "GlobalEventHandlers" different from "Element"?
querySelector function actually just grabs a reference to a particular element that you can use to perform other actions on the element. After grabbing that reference, you can then use a global event handler such as
onclick (like you do in this project) to execute a function once that event handler has executed on that element. So, these two functions work together to produce interactive content. :)