Get image src with jQuery

前端 未结 3 505
-上瘾入骨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:11

    alert( $('img')[0].src );
    

    this might do the trick... but not sure about cross browser....

    demo in here

    also try prop of jQuery 1.6..

    alert( $('img').prop('src') );
    

    demo here

提交回复
热议问题