How can I select an image inside of a div to change its source?

前端 未结 2 1718
再見小時候
再見小時候 2021-02-07 04:38

I have the following div and I know the selector Id of the DIV.

 
2条回答
  •  执念已碎
    2021-02-07 05:09

    $('div.event img').attr('src', '/anything');
    

    If you have several divs with event as the class you're better off selecting the div by id if you don't want to change the source of all the images

提交回复
热议问题