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


Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!