+ 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

27th Nov 2018, 8:41 PM
Yosharu
Yosharu - avatar
1 Réponse
+ 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.
26th May 2025, 3:46 AM
CNNMN01
CNNMN01 - avatar