Why is this small javascript not working?
<p>I have multiple instances of a div with an id of "myDiv" on a page. I want to replace the contents of these divs. When I use this javascript:</p>

<pre><code>function replaceContent(id, content) {
    var container = document.getElementById(id);
    container.innerHTML = content;
}

replaceContent('myDiv', 'hello there');


&lt;div id="myDiv"&gt;&lt;/div&gt;
&lt;div id="myDiv"&gt;&lt;/div&gt;
&lt;div id="myDiv"&gt;&lt;/div&gt;
</code></pre>

<p>It only replaces the content inside one of those divs and not all of them. If I use the .html() function of jquery instead, it replaces the contents of all divs. Is there any way I can get the above js to work in the same way?</p>
