JQuery remove image src prefix

Posted by mtwallet on Stack Overflow See other posts from Stack Overflow or by mtwallet
Published on 2010-04-28T13:42:00Z Indexed on 2010/04/28 13:43 UTC
Read the original article Hit count: 179

Filed under:

Hi. I have a bunch of images on a page that are contained within a div with a class of content-block like this:

<div class="content-block">
    <img src="../images/path/path/image.jpg" alt="blah" title="blah" />
    <img src="../images/path/path/image.jpg" alt="blah" title="blah" />
    <img src="../images/path/path/image.jpg" alt="blah" title="blah" />
    <img src="../images/path/path/image.jpg" alt="blah" title="blah" />
    <img src="../images/path/path/image.jpg" alt="blah" title="blah" />
</div>

I am loading this html into a div via ajax. When I load it in I need to remove the "../" before the image path, after it loads in so the path remains correct. Can this be done with JQuery? Many thanks in advance.

© Stack Overflow or respective owner

Related posts about jQuery