+ 1
JavaScript error
i need help with js here https://code.sololearn.com/WGjkl2SA5LPv/?ref=app
8 Antworten
+ 5
+ 9
https://code.sololearn.com/W2Pn27azvqi2
+ 4
this is it
thanks Aaron Eberhardt
+ 3
Aaron Eberhardt actually i need to show/hide div on clicking list elements.
list elements stays there
+ 3
Aaron Eberhardt not any div element
i need to display the child div
+ 3
one last doubt Aaron Eberhardt
why isn't the other div displayed when i click on english?
is there some kind of scope for searching tags?
edit: never mind, got it
thanks for the help
+ 3
As far I know getElementsByTagName will always return elements in the same order as in the html. The argument a which you pass to the function will be 0 for English, which is also the first div. Mandarin passes 1 to the function, so the second div will be changed.
+ 2
You need to take care that getting elements by tag name can return multiple elements, so you need to use variable[num] to access them. I hope this is what you wanted:
https://code.sololearn.com/WME9HqfqsJjx/?ref=app