0
Onclick dropdown menu function
Hello, does anyone know why this onclick function not working? Thank you https://code.sololearn.com/W6dYyQ7L5ukn/?ref=app
2 Answers
+ 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')
}
}
+ 1
Thank you! I will try this