title: What is the difference between class and classname in javascript?
body: <p>In order to find children objects of a certain class name, I had to create my own helper function</p>
  
  <pre><code>findChildrenByTagName = function(obj, name){
      var ret = [];
      for (var k in obj.children){
          if (obj.children[k].className === name){
              ret.push(obj.children[k]);
          }
      }
      return ret;
  }
  </code></pre>
  
  <p>An example of how it works is </p>
  
  <pre><code>var li = document.createElement('li');
  var input = document.createElement('input');
  input.setAttribute('class','answer_input');
  li.appendChild(input);
  console.log(findChildrenByTagName(li,"answer_input"));
  </code></pre>
  
  <p>However when I replace className above by class in the function above, the code doesn't work. So I am naturally wondering what the difference is between class and className. A quick search on google doesn't reveal anything. </p>
  
  <p>Also what's the best way to return a list of children of a particular class name for a generic object? If such doesn't exist, is there a way to add a method to all objects so that I can call </p>
  
  <pre><code>li.findChildrenByTagName("answer_input");
  </code></pre>
  
  <p>instead of the global function above? </p>