DEV Community

Discussion on: How to show the clicked element only and hide others in Vanilla JavaScript?

Collapse
 
mohdhussein profile image
Mohammed

Loops saved me here. My first solution was using ‘if else’ statement for each one. So the bigger the list the more I write.

I did what you said at first but I added more since its common for the first button to be clicked by default.

Thank you for your reply. 👍