title: Fill div with html using javascript/jquery
body: <p>here is my problem:</p>
  
  <p>I have a div: </p>
  
  <pre><code>&lt;div id="legend"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and I want to fill it, under certain conditions, with this other code:</p>
  
  <pre><code>&lt;p&gt;Showing results....
      Key:
      &lt;img src="/...."&gt;&amp;lt;=1
      &amp;nbsp;&lt;img src="/..."&gt;&amp;lt;=2
      &amp;nbsp;&lt;img src="/..."&gt;&amp;lt;=3
      &amp;nbsp;&lt;img src="/..."&gt;&amp;lt;=4
      &amp;nbsp;&lt;img src="/..."&gt;&amp;lt;=5
  
  &lt;p&gt;
  </code></pre>
  
  <p>As you can see this is a legend and the main issue I think is that I have double quotes that cannot be easily included using for instance the solution here:
  <a href="https://stackoverflow.com/questions/10756448/fill-div-with-text">Fill div with text</a></p>
  
  <p>Thanks for your help!</p>