title: Check <a> elements for attr target=“blank” and if so open new window via JavaScript
body: <p>I'm trying to open link with <code>target="_blank"</code> attribute via JavaScript.</p>
  
  <p>This action required to open popup window in web app, otherwise it’s open in external browser.</p>
  
  <p>I’m using jQuery to detect <code>target</code> of the <code>&lt;a&gt;</code> element, but the code below doesn’t work.</p>
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(function() {
    $("a").on('click', function(event) {
      if ($(this).attr('target')) == "_blank" {
        var win = window.open($(this).attr('href'), '_blank');
        win.focus();
        return false;
    });
  });
  </code></pre>