Jquery open this link not the others
<p>So, I have a series of divs and inside each div there is a link.</p>

<p>What I want to accomplish is to open in another window or tab the .pdf file if the link ends in.pdf if not do nothing or something else to decide later.</p>

<p>The problem I'm having is that when you click on the link it will open the same document as many times as you have .pdfs on the page.</p>

<p>I tried replicating the problem in this fiddle:</p>

<p><a href="https://jsfiddle.net/x9fo6cgk/" rel="nofollow">https://jsfiddle.net/x9fo6cgk/</a></p>

<p>But it isn't working. The code works on my side.</p>

<p>Here is the code:</p>

<pre><code><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>    $('.somelink').click(function(eventObject) {
      var elem = $(this);
      if (elem.attr("href").match(/\.pdf$/i)) {
        eventObject.preventDefault();
        elem.attr('target', '_blank');
      }
    });</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;div class="linkholder"&gt;
      &lt;a class="somelink" href="https://bitcoin.org/bitcoin.pdf"&gt;pdf 1&lt;/a&gt;
    &lt;/div&gt;

    &lt;div class="linkholder"&gt;
      &lt;a class="somelink" href="http://www.pdf995.com/samples/pdf.pdf"&gt;pdf 2&lt;/a&gt;
    &lt;/div&gt;

    &lt;div class="linkholder"&gt;
      &lt;a class="somelink" href="http://www.bing.com"&gt;.com&lt;/a&gt;
    &lt;/div&gt;

    &lt;div class="linkholder"&gt;
      &lt;a class="somelink" href="http://www.google.org"&gt;.org&lt;/a&gt;
    &lt;/div&gt;</code></pre>
</div>
</div>

</code></pre>

<p>Thanks in advance!</p>