javascript-view-swapping Flashcards
What is the event.target?
event.target refers to the element that triggered an event.
What is the affect of setting an element to display: none?
Setting an element’s display property to none will cause the element to be hidden from view on the web page.
What does the element.matches() method take as an argument and what does it return?
The Element.matches() method takes a single argument, which is a CSS selector that specifies the element or elements you want to match. The method returns a boolean value indicating whether the element matches the given selector.
How can you retrieve the value of an element’s attribute?
getAttribute({attribute you’re looking for})
At what steps of the solution would it be helpful to log things to the console?
Along the way at each step
If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?
you would need to attach event listeners to each element
If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?
you would have to set up listeners for each tab you would use if else statements for each element.