更新时间:2022-05-04 18:35:35
之所以不起作用,是因为jQuery期望DOM节点找到"title"标签.如您所述,您需要先解析html文本.
The reason why it does not work is because jQuery expects a DOM node to find the 'title' tags. As you noted, you need to parse the html text first.
从此处和
From here and here, the solution is to parse the string and append it into a temporal div (or other element):
var tempDom = $('<div></div>').append($.parseHTML(str));
然后,您可以操纵tempDom
来查找元素.
Then, you can manipulate tempDom
to find elements.