title: How can I change the color of a progress bar using javascript?
body: <p>Please see my code so far (<a href="http://jsfiddle.net/hNn5b/739/" rel="nofollow noreferrer">jsfiddle</a>).</p>
  
  <p>I am trying to change the color of the progress bar once it reaches max capacity.</p>
  
  <p>How can I accomplish this?</p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;textarea&gt;&lt;/textarea&gt;
  &lt;span id="characters"&gt;255 left&lt;/span&gt;
  
  &lt;br&gt;
  &lt;progress id="myProgress" value="0" max="255"&gt;
  &lt;/progress&gt;
  </code></pre>
  
  <p>JS code:</p>
  
  <pre><code>$('textarea').keyup(updateCount);
  $('textarea').keydown(updateCount);
  
  function updateCount() {
       var max = 255;
      var cs = $(this).val().length;
      document.getElementById("characters").innerHTML= max-cs + " left..";
      document.getElementById("myProgress").value = cs;
      if (event.which &lt; 0x20) {
          return;
        }
      if (cs == max) {
          event.preventDefault();
          // make the color of progress bar red here!! 
        }     
  
  }
  </code></pre>