Posted By

pedromagalhaes on 02/23/11


Tagged

target


Versions (?)

Change Attribute Values for Links


 / Published in: jQuery
 

If you wish to change attributes in a link you can make use of this snippet. For example, you can add "name", "id", "class", "target", etc.

  1. $(document).ready(function(){
  2. $(function(){
  3. $("a[href^='http']").attr('target','_blank');
  4. $("a[href^='.pdf']").attr('target','_blank');
  5. $("a[href^='http://app.readspeaker.com']").attr('target','_blank');
  6. });
  7. });

Report this snippet  

You need to login to post a comment.