I'm working with JavaScript code where I need to create a menu structure. I'm using an append statement and adding code for each topic, with a list of sub topics in it for the script to render the whole thing as a menu. This works fine if I don't space out the tags in the string but I want it to look cleaner for debugging and editing purposes.
sidebarMainMenu.append('\
<li id="par-1-menu"><a href="topic1.html">MainTopic-1</a>\
<ul class="sub-menu">\
<li id="sub-par-1-1-menu"><a href="topic1.html#sub-par-1-1">#1: SubTopic-1</a></li>\
<li id="sub-par-1-2-menu"><a href="topic1.html#sub-par-1-2">#2: SubTopic-2</a></li>\
<li id="sub-par-1-3-menu"><a href="topic1.html#sub-par-1-3">#3: SubTopic-3</a></li>\
<li id="sub-par-1-4-menu"><a href="topic1.html#sub-par-1-4">#4: SubTopic-4</a></li>\
<li id="sub-par-1-5-menu"><a href="topic1.html#sub-par-1-5">#5: SubTopic-5</a></li>\
<li id="sub-par-1-6-menu"><a href="topic1.html#sub-par-1-6">#6: SubTopic-6</a></li>\
</ul>\
</li>\
');
This gives me the error: Uncaught SyntaxError: Unexpected token ILLEGAL
Not sure what I missed here but I'm certain it's a minor mistake. Regardless, is this even the right approach to handling multi-line string arguments in JS functions? Thanks in advance.