fbpx
11 C
Lahore

jQuery: How to open specific links in new tab having specific url?

Just put following code in your javascript file and It will pick all links globally from your website and will open them in a new tab. Don’t forget to replace url with your own website’s url.

$(document).ready(function(){
    $('a[href*="website.com"] ').click(function(e) {
    	e.preventDefault();
        window.open(this.href, '_blank');
        return false;
    });
});

 

- Advertisement -spot_img

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article