JQuery change the value of an <img

后端 未结 5 1656
旧时难觅i
旧时难觅i 2021-02-05 12:28

I need some simple JQuery code so I can change the src value of a specific img.

It\'s currently:


<         


        
5条回答
  •  无人及你
    2021-02-05 13:16

    You could use the .attr() function to set attributes on given DOM element:

    $(function() {
        $('#myImage').attr('src', 'image2.gif');
    });
    

提交回复
热议问题