your second solution worked perfectly, didnt try the first one.
thanks!!
On May 10, 3:10 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> Untested (and I haven't slept in a while):
>
> $('[EMAIL PROTECTED]"http://"]').addClass('external');
>
> Or more along the lines of what you were doing before:
>
> $('a').filter(function() { return this.href.indexOf('http://') == 0;
>
> }).addClass('external');
>
> --Erik
>
> On 5/10/07, stef <[EMAIL PROTECTED]> wrote:
>
>
>
> > im trying to add a class to link elements that point to an external
> > page, using indexOf("http://") on the href attribute to see if they
> > are internal or external links. im using the line below, but it gives
> > an error probably cause of invalid syntax.
>
> > $("a").attr("href").indexOf("http://")
>
> > if i use var linksHref = $("a").attr("href") it only gets the href
> > value of the first link, not all of them. im looping through all links
> > to check if indexOf("http://") is == 0, if so -> add the class, if
> > not, don't
>
> > perhaps not the best technique to mark external link, but it's just a
> > learning excercise for me. is there a way to grab ALL href attibutes
> > on the page?