使用jQuery获取图像src
问题描述:
<img src="../img/arnold.png" alt="Arnold">
如何获得这个图像的jQuery绝对路径?
How do I get with jQuery absolute path of this image?
img.attr(src)
让我只是 ../ img / arnold。 png ,应该输入 http://site.com/data/2011/img/arnold.png (完整网址)。
img.attr("src")
gives me just "../img/arnold.png", should give something like "http://site.com/data/2011/img/arnold.png" (full url).