title: How to select previous element in jquery?
body: <p>i have an image and i would like to assign which element of the area is clickable.
  <a href="https://i.stack.imgur.com/08c0Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/08c0Y.png" alt="enter image description here" /></a></p>
  <p>The red stripe shouldn't be clickable.</p>
  <p>My HTML solution:</p>
  <pre><code>&lt;img src=&quot;&quot; data-highres=&quot;&quot; usemap=&quot;#img&quot;&gt; 
  &lt;map name=&quot;img&quot;&gt;
     &lt;area class=&quot;show-modal&quot; shape=&quot;rect&quot; cords=&quot;&quot; href=&quot;&quot;&gt;
  &lt;/map&gt;
  </code></pre>
  <p>So when i click on the white area it should show me a modal window with &quot;this&quot; image.</p>
  <p>my jquery solution:</p>
  <pre><code>$('.show-modal').on('click', function(e){
              e.preventDefault();
              var highres = $('').attr(&quot;data-highres&quot;);
              $('.modal').css('display', 'block');
              $('#modal-image').attr('src', highres);
          });
  </code></pre>
  <p>When i click on the image(white area) it sould show me a high resulation image in a modal window.</p>
  <p>I left the <strong>$(&quot;&quot;)</strong> selector empty because i don't know how to select the img attribute -&gt; <strong>data-highres=&quot;&quot;</strong></p>
  <p>I tried with the previous selector but it didn't work.</p>