zack
zack

Reputation: 484

pjax with internal page target blank

I'm using pjax on one of my projects. I have a problem with opening a page in a new tab/window.

pjax seems to open all links in the same window except for external website links.

Pjax code

$(function(){
  $(document).pjax('a', '.main-header');
});

Can anyone tell me what seems to be the problem with url's that have target="_blank" and how to fix it? Really appropriate your help.

Upvotes: 0

Views: 1024

Answers (1)

putvande
putvande

Reputation: 15213

I believe you can use the selector like this to only select a tags that don't have a target="_blank":

 $(document).pjax('a:not(a[target="_blank"])', '.main-header')

Upvotes: 2

Related Questions