title: jQuery get attr id of an active image
body: <p>Im stuck on some jquery, and I dont know why it isnt working...</p>
  
  <pre><code>$('img').click(function() {
      $('img').removeClass('bob');
      $(this).addClass('bob');
  });
  
  var test = $('img.bob').attr('src');
  $('div.button').click(function() {
      alert(test);
  });
  </code></pre>
  
  <p>basically i need to get the attr ID of the image selected, but the alert only returns 'null'.</p>
  
  <p>Any suggestions would be greatly appreciated. Im pulling my hair out...</p>
  
  <p>A.</p>