Posted By

Moridin on 08/25/10


valid html xhtml strict blank links external

Versions (?)

Valid (X)HTML Strict with external links

 / Published in: jQuery

Uses jQuery to give links with rel=\"external\" the ability to open in a new window, while keeping the document XHTML or HTML Strict. Works by assigning a \"_blank\" value to the \"target\" attribute of all such links after the page has already loaded.

  1. $(function() {
  2. $('a[rel^=external]').each(function() {
  3. $(this).attr('target', '_blank');
  4. });
  5. });

Report this snippet  

You need to login to post a comment.