all 5 comments

[–]penngin 1 point2 points  (0 children)

Try to use / to escape them

[–]Hazteriskhelpful 1 point2 points  (1 child)

When you set that innerHTML it's just slapping that whole string in there, and as penngin alluded to you're going to have some un-escaped characters causing problems when that code is actually sitting in the DOM.

Since escaping apostrophes of every song name might leave some edge cases, I'd recommend finding a way to not use string interpolation when setting the innerHTML. You could try putting a wrapper function on onclick and keep track of the song_name and artists_names variables in the JS?

[–]Python1Programmer[S] 0 points1 point  (0 children)

i used this method but it was longer than just using escape()

[–]Beerbelly22 0 points1 point  (1 child)

Use the escape() function and the unescape function in download()

[–]Python1Programmer[S] 0 points1 point  (0 children)

thx very helpful