[jQuery] Re: Modifying href attribute values

2009-03-15 Thread Jonny Stephens
This seems to work: $('a').each(function() { $(this).attr('href','path/to/' + RegExp("[^#]+$").exec($(this).attr ('href')) + '.html'); }); On Mar 15, 7:03 pm, Jonny Stephens wrote: > Oops. Wrote too soon. > > Works fine for a single anchor. With multiples, all receive the same > href value

[jQuery] Re: Modifying href attribute values

2009-03-15 Thread Jonny Stephens
Oops. Wrote too soon. Works fine for a single anchor. With multiples, all receive the same href value as the first. Needs an .each() somewhere? On Mar 15, 5:44 pm, Jonny Stephens wrote: > Thanks Brad, that's perfect! > > Jonny > > On Mar 15, 5:29 pm, Brad wrote: > > > There is probably a more

[jQuery] Re: Modifying href attribute values

2009-03-15 Thread Jonny Stephens
Thanks Brad, that's perfect! Jonny On Mar 15, 5:29 pm, Brad wrote: > There is probably a more concise way to do this, but I'll break down > the steps > > // regular expression pattern to get the hash value > var patt = new RegExp("[^#]+$"); > > // The href of your attribute. This is a generic e

[jQuery] Re: Modifying href attribute values

2009-03-15 Thread Brad
There is probably a more concise way to do this, but I'll break down the steps // regular expression pattern to get the hash value var patt = new RegExp("[^#]+$"); // The href of your attribute. This is a generic example, you will // probably need to provide a more specific jQuery selector to ge