+ 1

JavaScript error

i need help with js here https://code.sololearn.com/WGjkl2SA5LPv/?ref=app

28th Jun 2018, 3:42 PM
‎ ‏‏‎Anonymous Guy
8 Antworten
28th Jun 2018, 4:08 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 9
https://code.sololearn.com/W2Pn27azvqi2
28th Jun 2018, 4:04 PM
Lakhvir Singh
Lakhvir Singh - avatar
+ 4
this is it thanks Aaron Eberhardt
28th Jun 2018, 4:10 PM
‎ ‏‏‎Anonymous Guy
+ 3
Aaron Eberhardt actually i need to show/hide div on clicking list elements. list elements stays there
28th Jun 2018, 3:56 PM
‎ ‏‏‎Anonymous Guy
+ 3
Aaron Eberhardt not any div element i need to display the child div
28th Jun 2018, 4:06 PM
‎ ‏‏‎Anonymous Guy
+ 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
28th Jun 2018, 4:17 PM
‎ ‏‏‎Anonymous Guy
+ 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.
28th Jun 2018, 4:22 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 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
28th Jun 2018, 3:50 PM
Aaron Eberhardt
Aaron Eberhardt - avatar