Change image link src [closed]

-3

I have multiple images in lists,

link 150-150 / 212-Vip --- brinde.jpg

I would like to change only the 150-150 to 200-200 for all.

I can only change one.

    
asked by anonymous 20.08.2014 / 18:29

2 answers

1

Assuming there is no possibility of this 150-150 expression being repeated anywhere in the URL, it would look something like this:

$( document ).ready( fucntion() {

    $( 'ul#something li img' ).each( function() {

        var path = $( this ).attr( 'src' );

        $( this ).attr( 'src', path.replace( '150-150', '200-200' ) );

    });
});

Set the seltor, iterate and for each found image you get the path , replace it and redefine it.

    
20.08.2014 / 19:25
1

I did not test, but considering 'image' being the link you passed, this probably works:

imagem = imagem.replace("150-150", "200-200");
    
20.08.2014 / 19:25