getting the absolute path of a

后端 未结 1 594
执笔经年
执笔经年 2021-02-05 13:57

Using Javascript, is there a standard way to get the absolute path of an image? img.getAttribute(\"src\") only returns the src attribu

1条回答
  •  攒了一身酷
    2021-02-05 14:16

    Just do .src.

    $('img')[0].src = '/images/foo.gif'
    "/images/foo.gif"
    $('img')[0].src
    "http://stackoverflow.com/images/foo.gif"
    $('img')[0].getAttribute('src')
    "/images/foo.gif"
    

    0 讨论(0)
提交回复
热议问题