Bharat Negi
Bharat Negi

Reputation: 507

How to add target blank in a link

There is one problem to add target="_blank" attr in a link section in jQuery, please check below code:-

$('.ban-img4').click(function(){
    window.location = $(this).find("a").attr("href"); 
    return false;
});

Upvotes: 0

Views: 69

Answers (1)

rainerhahnekamp
rainerhahnekamp

Reputation: 1136

If you want that the link to open in new tab:

$('.ban-img4').click(function(){
  var link = $(this).find("a");
  window.open(link.attr("href"));
  return false;
});

Upvotes: 2

Related Questions