gpt4 book ai didi

jquery - 在 JQuery 中附加带引号的 html

转载 作者:行者123 更新时间:2023-12-01 06:28:32 25 4
gpt4 key购买 nike

当用户点击我网站的提要部分中的“喜欢”时,我会附加一些 HTML 标签。但它正在破裂。我尝试了网上很多可用的解决方案,但找不到解决方案。

这是我正在使用的代码:

$('#feed20').find('strong')
.append('<span original-title="<ul><li>
<a href="http://localhost/forex/profile/username">username</a>
</li></ul>" custom-style="view-more" class="tiply_html_click">1 more</span>');

最佳答案

您需要转义引号,试试这个 jsFiddle

$("#feed20").find("strong").append("<span original-title=\"<ul><li><a href='http://localhost/forex/profile/username'>username</a></li></ul>\" custom-style=\"view-more\" class=\"tiply_html_click\">1 more</span>");

关于jquery - 在 JQuery 中附加带引号的 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11884472/

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