如何在DIV中获取图像URL

问题描述 投票:0回答:1

如果图像在DIV中,我想问如何获得图像URL

<div style="background-image: url(https://img.vggcdn.net/img/cat/11554/2/13.jpg);" class="ibk radius-circle bkgdCover bkgd-nr profile-image"></div>

预先感谢。

puppeteer
1个回答
0
投票

不需要这个,我已经有了答案

let event_image = document.querySelector('div.ed-event-image-container').childNodes[1].style.backgroundImage;
    event_image = event_image.split(/"/)[1];
© www.soinside.com 2019 - 2024. All rights reserved.