Snippets

target=”blank” links in jQuery

The following snippet will open all links with the rel=”external” attribute in a new tab/window. The code can be easily customized to only open links with a specific class.

$('a[rel=external]').attr('target', '_blank');

Share this snippet