Dynamically replace img src attribute with jQuery

前端 未结 3 2180
清歌不尽
清歌不尽 2020-12-01 20:41

I am trying to replace the img source of a given source using jQuery. For example, when the image src is smith.gif, replace to johnson.gif. If williams.gif replace to brown.

3条回答
  •  感情败类
    2020-12-01 21:18

    In my case, I replaced the src taq using:

       $('#gmap_canvas').attr('src', newSrc);

提交回复
热议问题