title: Iterate through a list of elements and hide them
body: <p>In javascript (jquery), I'm retrieving a list of elements that start with "#error-". This works correctly. The problem I have is that I can't assign a value to elements of the array while looping through it.</p>
  
  <p>I'm using this function:</p>
  
  <pre><code>function HideErrorMessages(){
      var errors = $('*[id^="error-"]');
      for (var i = 0; i &lt; errors.length; i++) {
          errors[i].css('display', none);
      }
  }
  </code></pre>
  
  <p>As you can see, I tried this "css" possibility. Doesn't work.
  I also tried:</p>
  
  <ul>
  <li>errors[i].hide();</li>
  <li>errors[i].style.display = 'none';</li>
  </ul>
  
  <p>But when using " alert(errors[i]) ", I get a response which indicates that it contains a list of "span" elements (which is correct).</p>
  
  <p>So how can I do to hide elements in this loop?</p>
  
  <p>Thanks!</p>