gpt4 book ai didi

javascript从字符串中提取html block

转载 作者:行者123 更新时间:2023-11-28 16:28:59 25 4
gpt4 key购买 nike

我从 div 中提取了一个字符串并将其存储在变量“str”中。我现在需要提取 <a href="blah">...</a>它的子集。

str = '<div id="xyz"><p>This is a paragraph</p><a href="http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=brd&FlightID=2997227&Page=&PluID=0&Pos=9088" target="_blank"><img src="http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=bsr&FlightID=2997227&Page=&PluID=0&Pos=9088" border=0 width=300 height=250></a></div>';

预先感谢您对此提供的任何帮助。

最佳答案

您可以尝试如下操作:

var a = $(str).find('a').html();

关于javascript从字符串中提取html block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6854686/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com