title: Adding a class to the parent div of a specific image
body: <pre><code>  (function(){
    var photoTemplate, resource;
  
    function init(){
      bindEventHandlers();
      photoTemplate = _.template($('#photo-template').html());
    }
  
    function toTemplate(photo){
      photo = {
        count: photo.likes.count,
        avatar: photo.user.profile_picture,
        photo: photo.images.low_resolution.url,
        url: photo.link
      };
  
      return photoTemplate(photo);
    }
  
    function toScreen(photos){
      var photos_html = '';
  
      $('.paginate a').attr('data-max-tag-id', photos.pagination.next_max_id)
                      .fadeIn();
  
      $.each(photos.data, function(index, photo){
        photos_html += toTemplate(photo);
      });
  
      $('div#photos-wrap').append(photos_html);
    }
  
    function generateResource(tag){
      var config = Instagram.Config, url;
  
      if(typeof tag === 'undefined'){
        throw new Error("Resource requires a tag. Try searching for cats.");
      } else {
        // Make sure tag is a string, trim any trailing/leading whitespace and take only the first 
        // word, if there are multiple.
        tag = String(tag).trim().split(" ")[0];
      }
  
      url = config.apiHost + "/v1/tags/" + tag + "/media/recent?callback=?&amp;client_id=" + config.clientID;
  
      return function(max_id){
        var next_page;
        if(typeof max_id === 'string' &amp;&amp; max_id.trim() !== '') {
          next_page = url + "&amp;max_id=" + max_id;
        }
        return next_page || url;
      };
    }
  
  
  function paginate(max_id){    
          $.getJSON(generateUrl(tag), toScreen);
        }
  
        function search(tag){
          resource = generateResource(tag);
          $('.paginate a').hide();
          $('#photos-wrap *').remove();
          fetchPhotos();
        }
  
        function fetchPhotos(max_id){
          $.getJSON(resource(max_id), toScreen);
        }
  
        function bindEventHandlers(){
          $('body').on('click', '.paginate a.btn', function(){
            var tagID = $(this).attr('data-max-tag-id');
            fetchPhotos(tagID);
            return false;
          });
  
          // Bind an event handler to the `submit` event on the form
          $('form').on('submit', function(e){
  
            // Stop the form from fulfilling its destinty.
            e.preventDefault();
  
            // Extract the value of the search input text field.
            var tag = $('input.search-tag').val().trim();
  
            // Invoke `search`, passing `tag` (unless tag is an empty string).
            if(tag) {
              search(tag);
            };
  
          });
  
        }
  
        function showPhoto(p){
          $(p).fadeIn();
        }
  
        // Public API
        Instagram.App = {
          search: search,
          showPhoto: showPhoto,
          init: init
        };
      }());
  
      $(function(){
        Instagram.App.init();
  
        // Start with a search on yogofactory; we all love frozen yogurt :).
        Instagram.App.search('yogofactory');  
      });
  </code></pre>
  
  <p>it then goes to the HTML file and builds the gallery around this </p>
  
  <pre><code>&lt;script type="text/template" id="photo-template"&gt;
        &lt;div class='photo'&gt;
            &lt;img class='main' src='&lt;%= photo %&gt;' width='250' height='250' style='display:none;' onload='Instagram.App.showPhoto(this);' /&gt;
          &lt;img class='avatar' width='40' height='40' src='&lt;%= avatar %&gt;' /&gt;
          &lt;span class='heart'&gt;&lt;strong&gt;&lt;%= count %&gt;&lt;/strong&gt;&lt;/span&gt;
        &lt;/div&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm not to experienced when it comes to JS or jQuery. I'm looking for a way to add a class to the parent <code>&lt;div class="photo"&gt;</code>, when the image inside is <code>src="http://image.com/onlythisone.jpg"</code> and only when its that image.</p>
  
  <p>I have a gallery a large gallery pulling dynamically from the instagram database, I basically want to be able to hide certain photos that don't follow the hash tag rules I created for my promotion.</p>
  
  <p>Any help would be awesome! Thanks in advance!</p>