title: How can I apply a function to several images in jQuery?
body: <p>I need a little help with (probably) something really simple.</p>
  
  <p>I want to use a script which converts images from color to grayscale.
  I got it working partially — the first image turns gray, but the second won’t.</p>
  
  <p>I know this is because an id cannot be used multiple times:</p>
  
  <pre><code>var imgObj = document.getElementById('grayimage');
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>var imgObj = $(’.grayimage’)[0];
  </code></pre>
  
  <p>But it didn’t work. Changing it to <code>getElementByClass</code> also does not work. (Before people ask, I did change the <code>id</code> to class in the <code>&lt;img&gt;</code> tag.)</p>
  
  <p>I really could use some help here. Thanks in advance!</p>