Replace img path jquery

前端 未结 6 941
后悔当初
后悔当初 2021-01-26 18:48

I am trying to replace an img path in jquery (injecting into a remote page)

replace example.com/thumbs

with ex

6条回答
  •  迷失自我
    2021-01-26 19:16

    Look at this one, you wasn't setting src for an image.

    $(function() {
          $('img').each(function() {
              $(this).attr('src', $(this).attr('src').replace('thumbs', 'imagessss')); console.log('New src: ' + $(this).attr('src'));
              });
          });
    
    

提交回复
热议问题