Or even better:
$("[EMAIL PROTECTED]'https:']").attr("target","_blank");
It's easy to go overboard with JS where its not really needed. :)
Another thing you may need to consider is that some browsers seem to return
the full url for the href attribute, even for relative links. You may want
to filter out your own domain with .not("[EMAIL PROTECTED]'yourdomain.com']").
Blair
On 11/29/06, MichaL Sanger <[EMAIL PROTECTED]> wrote:
I think one of greatest features of jQuery is support of XPath and
CSS3 selectors, so why to mess up code with each() and match()?
Use this nice way:
$("[EMAIL PROTECTED]'http:']").click(function(){
...
});
More about it:
http://jquery.com/docs/Base/Expression/XPath/
http://jquery.com/docs/Base/Expression/CSS/
MichaL
2006/11/28, Michael Holloway <[EMAIL PROTECTED]>:
> Hi Adam,
>
> Welcome to the community.
> I haven't tried this, but how about:
>
> // each a-tag
> $('a').each(function(){
> // if the url contains http or https we take it it's an external url
> if(this.href.match(/https?/)){
> // when the link is clicked, open a popup and stop the parent
> going anywhere
> $(this).click(function(){
> window.open(this.href);
> return false;
> });
> }
> });
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/