jQuery update link

Posted by Happy on Stack Overflow See other posts from Stack Overflow or by Happy
Published on 2010-06-16T21:32:45Z Indexed on 2010/06/16 21:42 UTC
Read the original article Hit count: 134

Filed under:
|

Here is html:

<a href="http://site.com/any/different/folders/picture_name.jpg">Go and win</a>
<a href="http://site.com/not/similar/links/some_other_name.png">Go and win</a>

How to add some text after last "/" in href attribute (before picture_name.jpg) of each link?

The script should give something like:

<a href="http://site.com/any/different/folders/user_picture_name.jpg">Go and win</a>
<a href="http://site.com/not/similar/links/user_some_other_name.png">Go and win</a>

Here user_ is added.

There can be any length of the link.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about attribute