title: Javascript to build HTML
body: <p>this one may be simple but it has eluded me. I have Javascript code which builds elements in the DOM (using JSON from a server script). Some of the elements have "onclick" calls that I want to pass the ID variable to.</p>
  
  <p>I cannot seem to get the <code>onclick="downloadImg("' + d.data_id + '")"</code> syntax right. What should it be. The code below does not work. Thanks.</p>
  
  <pre><code>temp_html = temp_html + '&lt;img src="/link/to/img.png" onclick="downloadImg("' + d.data_id + '")"&gt;';
  </code></pre>