How to Get Element By Class in JavaScript?
<p>I want to replace the contents within a html element so I'm using the following function for that:</p>

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

ReplaceContentInContainer('box','This is the replacement text');

&lt;div id='box'&gt;&lt;/div&gt;
</code></pre>

<p>The above works great but the problem is I have more than one html element on a page that I want to replace the contents of. So I can't use ids but classes instead. I have been told that javascript does not support any type of inbuilt get element by class function. So how can the above code be revised to make it work with classes instead of ids? </p>

<p>P.S. I don't want to use jQuery for this.</p>
