title: Why does my function return undefined when calling document.getElementsByClassName?
body: <p>Im trying to create a simple switch using css/JavaScript. In the following  you can see that im calling </p>
  
  <pre><code>document.getElementsByClassName('onOffSwitch').style.animation = 'off';
  </code></pre>
  
  <p><a href="http://jsbin.com/mojuluz/edit?html,css,js,console,output" rel="nofollow noreferrer">jsBin</a></p>
  
  <p>What other code is needed for js to understand im talking about the div named 'onOffSwitch'? Was wondering why this current codeset doesn't work and how to fix it.</p>