排除 target=_blank 链接

Exclude target=_blank links

我有以下 jquery 表达式:

$('a').on("click", function (e) {
    window.LoadingPanel.Show();
});

如何排除所有带有 target="_blank" 的链接?

$("a[target!='_blank']").on("click", function (e) {
    window.LoadingPanel.Show();
});
$("input[target!='_blank]").on("click", function (e) {    
    window.LoadingPanel.Show();
});

来源:https://api.jquery.com/attribute-equals-selector/

您也可以使用

<script>


 $(document).ready(function() {
    $('a:not([target="_blank"])').on('click', function(event) {
      event.preventDefault();

      /* Act on the event */
    });
  });
 </script>