Onclick dropdown menu function | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis

Onclick dropdown menu function

Hello, does anyone know why this onclick function not working? Thank you https://code.sololearn.com/W6dYyQ7L5ukn/?ref=app

30th Mar 2019, 9:03 PM
FlyiiingDani - avatar
2 Respostas
+ 2
Search the functions that are giving you trouble and usually something pops up on google . https://stackoverflow.com/questions/24219702/struggling-with-classlist-add-and-getelementsbyclassname change your DropDown function to this and it should work function DropDown() { var elements = document.getElementsByClassName("dropdown"); for(ele of elements) { ele.classList.toggle('active') } }
30th Mar 2019, 9:37 PM
Bruno Costa
Bruno Costa - avatar
+ 1
Thank you! I will try this
30th Mar 2019, 9:46 PM
FlyiiingDani - avatar