/ Published in: jQuery

XHTML 1.0 Strict does not allow the target attribute on links. The recommended way of specifying external links is to give the link a rel attribute of "external". This jQuery snippet finds likes with rel attributes of "external" and dynamically adds a target attribute of "_blank" so they will open in a new tab/window while maintaining valid XHTML 1.0 Strict code.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function () { $('a[rel~=external]').attr('target', '_blank'); });
Comments
