gpt4 book ai didi

javascript - jQuery : Delete span from title tag

转载 作者:行者123 更新时间:2023-11-28 11:48:33 24 4
gpt4 key购买 nike

请问我如何获得我尝试使用的标题标签的跨度

console.log($('title > span').text()); 

但它返回一个空结果。例如,我想从这段代码中获取“美丽”这个词:

<title>lorem epsum dolor <span class="spa">beautiful</span></title>

最佳答案

<title>标签内不应包含任何其他标签。

如此处所述https://www.w3.org/TR/html401/struct/global.html#h-7.4.2

Titles may contain character entities (for accented characters, special characters, etc.), but may not contain other markup (including comments).

关于javascript - jQuery : Delete span from title tag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42070218/

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