title: Get image attribute based on class name
body: <p>I have some images which have <code>data-url</code> attribute i want to get the value of the <code>data-url</code> based on the click on an element.</p>
  
  <h2>My html is</h2>
  
  <pre><code>&lt;img class="youtube-poster" src=" http://i2.ytimg.com/vi/juIJGBxj-4w/maxresdefault.jpg " data-url="https://www.youtube.com/embed/juIJGBxj-4w"&gt;
  &lt;div class="video-poster-player"&gt;&lt;i class="play"&gt;&lt;/i&gt;&lt;div&gt;
  </code></pre>
  
  <h2>And my js is</h2>
  
  <pre><code>$(document).on('click', '.video-poster-player', function(event) {
    var className = $(event.target).attr('class');
    var frameurl = className.parent().find('.youtube-poster').data('url')
  
    console.log(className)
    console.log(frameurl)
  });
  </code></pre>
  
  <p>In console it is <code>className.parent is not a function</code></p>