title: Changing content of class using Javascript
body: <p>I started reading JavaScript in W3schools and testing out/changing few things in the examples they give so I can see what is doing what but didn't manage to identify the syntax, yet.</p>
  
  <p>Below is the original code to change p tag content,  <em>the <a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_inner_html" rel="nofollow noreferrer">link</a> to it.</em></p>
  
  <pre><code>&lt;p id="demo"&gt;
      JavaScript can change the content of an HTML element.
  &lt;/p&gt;
  
  &lt;script&gt;
  function myFunction()
  {
      x = document.getElementById("demo");  // Find the element
      x.innerHTML = "Hello JavaScript!";    // Change the content
  }
  &lt;/script&gt;
  
  &lt;button type="button" onclick="myFunction()"&gt;Click Me!&lt;/button&gt;
  </code></pre>
  
  <p>I want to know how to change contents with the same class, but failed as you can see that the example below doesn't work. <a href="http://jsfiddle.net/37jq9/" rel="nofollow noreferrer">Fiddle of code below</a>.</p>
  
  <pre><code>&lt;p class="demo"&gt;
      JavaScript can change the content of an HTML element.
  &lt;/p&gt;
  
  &lt;p class="demo"&gt;Yolo&lt;/p&gt;
  
  &lt;script&gt;
  function myFunction()
  {
      x = document.getElementsByClassName("demo");  // Find the element
      x.innerHTML = "Hello JavaScript!";    // Change the content
  }
  &lt;/script&gt;
  
  &lt;button type="button" onclick="myFunction()"&gt;Click Me!&lt;/button&gt;
  </code></pre>
  
  <p>If you could show me how ^^" and help me understand, is "getElementById" a variable that could be anything else or is it a command?</p>