/ 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
$(document).ready(function () { $('a[rel~=external]').attr('target', '_blank'); });
You need to login to post a comment.
