Hi Justin, Instead of using $('a.redir'), try using $('[EMAIL PROTECTED]')
That will select all links with "mysite.com" anywhere in the href --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 24, 2007, at 10:47 PM, [EMAIL PROTECTED] wrote:
Hello, I was hoping someone could help me out with a little issue im having. I want jquery to convert the target of any link that isn't within my internal site. i tried it one way, in which i added a class to each link that was to go outside. that worked and turned the links from... <a class='redir' href="http://google.com">Google</a> --to-- <a class='redir' href="http://mysite.com/redirect.php?url=http:// google.com">Google</a> --using the jquery-- $("a.redir").attr("href","<?=$root;?>frame.cfmx?url=" + $ ("a.redir").attr("href")); buuut... i want to get rid of using the classes altogether. whats the right way to see if mysite.com is in the href part of the link, and if its not, append my redirect script. ive started it below but its just not working for me if($("a").attr("href").contains("http://mysite.com") == false) { $(this).attr("href","http://mysite.com/redirect.php?url=" + $ (this).attr("href")); }