title: How can I pass a variable through an onclick event when javascript is creating the html?
body: <p>My javascript creates a line of html.</p>
  
  <p>That html has an onclick event call to <code>openSingle()</code>.</p>
  
  <p>I need to pass a variable into that function.</p>
  
  <p><code>onclick="openSingle('+findID+')"</code></p>
  
  <p>When I check the dev panel when it runs, i get</p>
  
  <p><code>onclick="openSingle(WP0100200-3a)"</code></p>
  
  <p>The only thing that is missing is the quotes around the <code>id</code>.
  But if i try to code in the quotes, it breaks the html and then puts everything out of order.</p>
  
  <p>Here is my line of code and all the pertaining variables.</p>
  
  <pre><code>var iconImage = '&lt;img src="../../resources/images/annotation-icon.png" style="float:left; margin-left:20px; margin-right:0px;"onclick="openSingle('+findID+')"/&gt;';
  var paragraph = '&lt;p id="Manual-para" class="colorMe"&gt;&lt;a href="';
  var redirect = linkMe + '#' + findID;
  var manName = section.childNodes( x ).getAttribute( "manualName" );
  var workPack = section.childNodes( x ).getAttribute( "workPacket" );
  
  document.getElementById( "annotateBody" ).innerHTML += iconImage + paragraph + redirect + '"&gt;' + annotationTitle + ' - ' + manName + ' - ' + workPack + '&lt;/a&gt;&lt;/p&gt;';
  </code></pre>