Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Auto inernal links with jquery
  2. $(document).ready(function(){
  3.     $("a[href]").each(function()
  4.    {
  5.       $link=this.href;
  6.       $text=this.text;
  7.  
  8.        $('*:contains("'+$text+'")').each(function(){
  9.      if($(this).children().length < 1){
  10.                 $(this).text($(this).text().replace($text, '<a href="'+$link+'" target="_blank">'+$text+'</a>'));
  11.       }
  12.  
  13.         });
  14.    });
  15.  
  16.   });
  17.        
  18. $("a[href]").attr('target', '_blank');