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:
Hi,

<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>

$('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 <knalp...@gmail.com <mailto: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