Posted By

gfazioli on 12/15/08


Tagged

css javascript jquery


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

sulfurito
kevcow
SmpleJohn
gfazioli
orhanveli
maxvee8
seanpowell
aegony


jQuery target blank link


 / Published in: JavaScript
 

URL: http://www.undolog.com/2008/12/15/very-short-snippet-jquery-auto-target-blank-link/

Add class external to all target=_blank links

  1. /**
  2.  * From jQuery 1.3+ release, avoid (at) char
  3.  */
  4. jQuery('a[target=_blank]').addClass('external');
  5.  
  6. /**
  7.  * Before jQuery 1.3 release
  8.  */
  9. jQuery('a[@target=_blank]').addClass('external');
  10. //
  11. /**
  12.  * css
  13.  
  14. .external{background:url(images/external.png) no-repeat right 3px;padding-right:14px}
  15.  
  16. */

Report this snippet  

You need to login to post a comment.