/ Published in: JavaScript

Add class external to all target=_blank links
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * From jQuery 1.3+ release, avoid (at) char */ jQuery('a[target=_blank]').addClass('external'); /** * Before jQuery 1.3 release */ jQuery('a[@target=_blank]').addClass('external'); // /** * css .external{background:url(images/external.png) no-repeat right 3px;padding-right:14px} */
URL: http://www.undolog.com/2008/12/15/very-short-snippet-jquery-auto-target-blank-link/
Comments
