+ 8

Question on Display (reposted to get an answer more quickly)

In a code I am working on, I can only show the full lyrics of something once and return to the main page. After that, nothing shows when you try to display lyrics. Why does this happen? Note: I declared one function twice (the one that defines the variables) to try and fix the problem, but it isn't really doing anything that I can see. https://code.sololearn.com/Wl4BcCD5UHhQ/?ref=app Thanks, Dustin

19th Oct 2020, 7:33 PM
Dustin đŸ‡ș🇾
2 Answers
+ 8
Thank you for your help! You are awesome
19th Oct 2020, 9:17 PM
Dustin đŸ‡ș🇾
+ 4
Get rid of define() function. At line 231: "lyr" won't display anymore. When function "lyrics" is called again you make "x" visible but it won't render because its container "lyr" is invisible. My fix: Instead of hidding the container of all lyrics just hide the lyric that was shown in the last call of "lyrics" function: var current; // global scope function lyrics(x) { current = x x.style.display = "block"; preview.style.display = "none"; } function prev() { current.style.display = "none"; preview.style.display = "block"; } You did well in reposting the question. Edits in questions are commonly unnoticed.
19th Oct 2020, 9:14 PM
Kevin â˜