JavaScript Treehouse Club - MASH MASH - JavaScript Handle Submission and Event Handler Functions

Question Any Help Will Be Appreciated.

When we use this syntax(document.querySelector) and we capture an ID what can you do if you capture an ID. Will it be doing something important to the program?

1 Answer

Snir Lugassy
Snir Lugassy
1,824 Points

querySelector is querying the document based on what you are looking for, and return an array of matched elements, for example, you can look for the buttons with class "cool button".

HTML ID attribute should be unique, therefore it is supposed to return an array with 1 item.

After you "capture" this element you can manipulate the DOM (if you don't understand the DOM i would recommend to learn it as deep as you can).