I'm looping through some data with a var called sortedlist[i].description that contains an URL. I need to build the following HTML output:
<div onclick="location.href='http://XXXXXX' class="MusicItem">
I'm building my HTML output with a var called output which accumulates into the full body of my page.
output += '<div onclick="location.href="' +
sortedlist[i].description + '" class="MusicItem">';
The above of course breaks. I clearly have an issue with my quotation usage/syntax but I've tried it every which way:
- alternating single to double quotes.
- only using single quotes. and
- using parens in place of the single quotes, etc.
Nothing is working.
'<a href="...">'requires one less "level" of string delimiters.