所以我有一个数据集,它在变量entry.content中返回类似这样的内容:
<p style="float:right;margin:0 0 10px 15px;width:240px"> <img src="http://citysportsblog.com/wp-content/uploads/2011/09/RagnarNE.jpg" width="240"> </p><p>Have you heard of the epic adventure that is the</p>
我如何通过 jquery 从中获取 img src url?
最佳答案
<删除> 假设您只有一张图像: var sourceUrl = $('img').attr('src');
var sourceUrl = $(entry.content).find('img').attr('src');
关于javascript - 如何通过jquery从html中获取图像标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7518290/