title: How to get contents of class through JavaScript
body: <p>I need to use JavaScript to get the username which is posted in the following way:</p>
  
  <pre><code>&lt;div id="project_user"&gt;
      &lt;p class="project_user"&gt;
          by &lt;span class="project_username"&gt;&lt;?php echo $OwnerName; ?&gt;&lt;/span&gt;
       &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I do it?</p>
  
  <p>I tried the following but it didn't work:</p>
  
  <pre><code>document.getElementById('project_username').innerHTML
  </code></pre>