javascript-view-swapping Flashcards
What is the event.target?
-It is a property of an event which is a reference to the element upon which the event was fired.
What is the affect of setting an element to display: none?
-It removes the element from the document.
What does the element.matches() method take as an argument and what does it return?
- argument: selectorString (a string representing the selector to test)
- return value: boolean value
How can you retrieve the value of an element’s attribute?
-getAttribute method
At what steps of the solution would it be helpful to log things to the console?
-whenever you want to check what the code is doing
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?
-It would be written much longer because you would have to target each tab and view 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?
-It would be written much longer because you would have to target each tab and view element and check if each element passes the conditionals.