 <blockquote> <p>The getElementsByClassName() method returns a collection of an element's child elements with the specified class name, as a NodeList object.</p> </blockquote> <p>You need to do this:</p> <pre><code>document.getElementsByClassName("aero")[0].innerHTML="&lt;span&gt;"+count+"&lt;/span&gt;"; </code></pre> <p>Refer <a href="http://www.w3schools.com/jsref/met_element_getelementsbyclassname.asp" rel="nofollow">getElementsByClassName() - W3</a></p>