Get image src with jQuery

前端 未结 3 507
-上瘾入骨i
-上瘾入骨i 2021-02-02 09:40
\"Arnold\"

How do I get with jQuery absolute path of this image?

img.attr(\"src\") give

3条回答
  •  佛祖请我去吃肉
    2021-02-02 10:01

    Give current clicked image source in jQuery

    jQuery(document).ready(function($){
    $('body').on('click','img',function(){
                    alert('it works');
                    var imgsrc=$(this).attr('src');
                    alert(imgsrc);
    });
    });
    

提交回复
热议问题