title: How do I use event listeners in IE-8 and earlier
body: <p>I would like a function which checks if a user has entered enough characters into a form. My code works in chrome but not in IE.</p>
  
  <pre><code>var elUsername = document.getElementById('username');  
  var elMsg      = document.getElementById('feedback');   
  
  function checkUsername(minLength) {                     
    if (elUsername.value.length &lt; minLength) {           
  
      elMsg.innerHTML = 'Username must be ' + minLength + ' characters or more';
    } else {                                             
      elMsg.innerHTML = '';                            
    }
  }
  
  elUsername.addEventListener('blur', function() {      
    checkUsername(5);                                     
  }, false);
  </code></pre>