title: Updating the content of a div with javascript
body: <p>Rather than trying to create tons of different pages on my website, I'm trying to update the content of a single div when different items in the navbar are click to update the maint div content. I tried to find a simple example using Javascript:</p>
  
  <pre><code>        &lt;script type="text/javascript"&gt;
              function ReplaceContentInContainer(id,content) {
                  var container = document.getElementById(id);
                  container.innerHTML = content;
              }
          &lt;/script&gt;
  
  
            &lt;div id="example1div" style="border-style:solid; padding:10px; text-align:center;"&gt;
              I will be replaced when you click.
          &lt;/div&gt;
          &lt;a href="javascript:ReplaceContentInContainer('example1div', '&lt;img src='2.jpg'&gt;' )"&gt;
              Click me to replace the content in the container.
          &lt;/a&gt;
  </code></pre>
  
  <p>This works just fine when I only try and update text, but when I put an img tag in there, as you can see, it stops working.</p>
  
  <p>Either 
  1) what is the problem with how I am trying to do it?
  or 2) What is a better/easier way to do it?</p>
  
  <p>I'm not stuck on Javascript. jQuery would work too, as long as it is just as simple or easy. I want to create a function that will just let me pass in whatever HTML I want to update and insert it into the div tag and take out the 'old' HTML.</p>