Changing the image source using jQuery

前端 未结 16 2081
天命终不由人
天命终不由人 2020-11-22 01:24

My DOM looks like this:

16条回答
  •  后悔当初
    2020-11-22 02:20

    You can also do this with jQuery in this way:

    $(".c1 img").click(function(){
         $(this).attr('src','/new/image/src.jpg');   
    });
    

    You can have a condition if there are multiple states for the image source.

提交回复
热议问题