[jQuery] Re: Manipulate href

2009-08-19 Thread knal
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ć wrote: > You n

[jQuery] Re: Manipulate href

2009-08-18 Thread anurag pal
Hi, Basically what I got from this query the initiator don't want to call full links again and again so I have write the which which he can concat and call the location so that it will hit to the particular page. Regards, Anurag Pal On Tue, Aug 18, 2009 at 4:03 PM, Liam Potter wrote: > > you wa

[jQuery] Re: Manipulate href

2009-08-18 Thread Liam Potter
you want to manipulate the string so, after doing what paul did. $('a').click(function() { var id = $(this).attr('href'); var orig = '/portfolio/category/' id.replace(orig, "#") } But I do not see what you are trying to achieve with this? anurag pal wrote:

[jQuery] Re: Manipulate href

2009-08-18 Thread Miloš Rašić
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 : > >

[jQuery] Re: Manipulate href

2009-08-17 Thread anurag pal
Hi, Animals Buildings Cars People $('a').click(function() { var id = $(this).attr('href'); now you can get the string after hash and then redirect it to the desired location. } Regards, Anurag Pal On Tue, Aug 18, 2009 at 12:37 AM, knal wrote: > > Hi group, > > I'm looking

[jQuery] Re: Manipulate href

2009-08-17 Thread knal
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

[jQuery] Re: Manipulate href

2009-08-17 Thread Peter Edwards
Hi knal This works for me: $(function(){ $('#my_list a').each(function(){ var href = $(this).attr("href"); /* remove trailing slash if present */ if (href[(href.length-1)]==="/") { href = href.substr(0,(href.length-1)); } /* now get the last part of the path */ var ancho

[jQuery] Re: Manipulate href

2009-08-17 Thread Leonardo K
$("#my_list a").each(function(){ newhref = '#' + $(this).attr('href').split("/")[3]; $(this).attr('href', newhref); }); On Mon, Aug 17, 2009 at 16:07, knal wrote: > > Hi group, > > I'm looking for a correct way of manipulating The code looks like this: > > > Animals > Buildings >

[jQuery] Re: Manipulate href

2009-08-17 Thread Miloš Rašić
$('#my_list a').each(function() { var hrefSplit = $(this).attr('href').split('/'); $(this).attr('href', '#'+hrefSplit(hrefSplit.length - 2)); }); 2009/8/17 knal : > > Hi group, > > I'm looking for a correct way of manipulating The code looks like this: > > >  Animals >  Buildings >  Cars >  P