Thanks Miloš,

This makes clear why things are the way they are :)

For everybody's information: i'm trying to make 'real' page requests
turn into Ajax requests
without losing functionality for people who don't have JS turned on.

Thanks again all.

On Aug 18, 12:29 pm, Miloš Rašić <milos.ra...@gmail.com> wrote:
> You need the each() method because you are modifying each href to a
> new value that depends on an old value. In order to do this, you need
> to somehow retrieve the old value and for this you need the $(this)
> pointer which is only available in the context of methods like each().
>
> 2009/8/17 knal <knalp...@gmail.com>:
>
>
>
> > Thanks a lot, both of you! Of course now it looks really simple, but i
> > couldn't fugure it out.
> > What i don't get is why i need the 'each' part, because so far, with
> > jQuery i would've just used
>
> > #my_list a
>
> > which i thought would also affect all a's in #my_list right?
>
> > Thanks again!
>
> > On 17 aug, 21:19, Leonardo K <leo...@gmail.com> wrote:
> >> $("#my_list a").each(function(){
> >>     newhref = '#' + $(this).attr('href').split("/")[3];
> >>     $(this).attr('href', newhref);
> >>   });
>
> >> On Mon, Aug 17, 2009 at 16:07, knal <knalp...@gmail.com> wrote:
>
> >> > Hi group,
>
> >> > I'm looking for a correct way of manipulating <a hrefs...
> >> > The code looks like this:
>
> >> > <ul id="my_list">
> >> >  <li><a href="/portfolio/category/animals/">Animals</a></li>
> >> >  <li><a href="/portfolio/category/buildings/">Buildings</a></li>
> >> >  <li><a href="/portfolio/category/cars/">Cars</a></li>
> >> >  <li><a href="/portfolio/category/people/">People</a></li>
> >> > </ul>
>
> >> > and with jQuery i want to manipulate it into this:
>
> >> > <ul id="my_list">
> >> >  <li><a href="#animals">Animals</a></li>
> >> >  <li><a href="#buildings">Buildings</a></li>
> >> >  <li><a href="#cars">Cars</a></li>
> >> >  <li><a href="#people">People</a></li>
> >> > </ul>
>
> >> > So only the last element in the URL has to stay, and a hash has te be
> >> > added...
> >> > I wouldn't know how to achieve this. I've been googling it for three
> >> > hours now, but i jus't can't get it to work.
> >> > Any help would be greatly appreciated!
>
> >> > Thanks,
> >> > Knal

Reply via email to