Set image src to another image jquery

后端 未结 3 1157
深忆病人
深忆病人 2020-12-17 08:33

I have a div with some images, and when I clicked on those images I want another div to open with that Image that I clicked.

JS

$(\'         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 09:29

    #image-zoom is an id for a div tag, which doesn't have a src attribute. So in order to change the image you've to traverse to img:

    $('#image-zoom img').attr("src",loc);
    

提交回复
热议问题