+ 1
Hiding Elements with a button error
Hi, I'm trying to make a button that will hide other elements and display another when clicked. I keep getting an error. Try clicking the credits button. https://code.sololearn.com/W8w1xyJAFskM/#jshttps://code.sololearn.com/W8w1xyJAFskM/#js
1 ответ
+ 1
Two problems:
1. Use === instead of = in your if statement
2. Only check ONE button, not all three
Since all your buttons do the same thing (hide/show together), you only need to check if the first one is hidden. If it is, show them all. If it’s not, hide them all.
Fix: Check just hideElementsCredit[0] in your if statement, then show/hide all three in the if/else blocks.