title: jQuery - iterate through all elements with class and change their style
body: <p>I know this is supposed to be simple, but I'm running into multiple problems. First of all, I don't know how to get all elements of a class and change their display. I found the <code>.each</code> method with this sample code:</p>
  
  <pre><code>$('.classname').each(function(index) {
          alert(index);
  });
  </code></pre>
  
  <p>What do I need instead of the alert to change the display property of an element from 'none' to block'?</p>
  
  <p>The second problem is, the class name is gathered from a hidden field. Let's name this variable <code>service</code>. When I try to replace the '.classname' with '.'+service I get an error saying 'Syntax error, unrecognized expression: .'.</p>
  
  <p>So the actual code would be something like:</p>
  
  <pre><code>var service=$('#service').val();
  $('.'+service).each(function(index) {
          alert(index);
  });
  </code></pre>
  
  <p>I'm sure this can't be complicated but I can't figure it out.</p>
  
  <p>Any alternative solution is of course welcome.</p>