gpt4 book ai didi

javascript - 添加 jquery 附加链接

转载 作者:行者123 更新时间:2023-12-02 17:56:44 26 4
gpt4 key购买 nike

我正在尝试添加一个 href 链接到 jquery 附加。单击该链接会打开一个 ajax 模式。

这就是我所拥有的

  $('<div/>').text(message.text).prepend($('<em/>')
.text('Opponent: '+ opponentName + ',' + ' ' + 'Game amount: ' + message.amount + ' ' + 'tokens,' + ' ' + 'Game: ' + message.game + ' ' + '<a href="#" data-toggle="ajaxModal">accept</a>')).appendTo($('#pendingChallenges'));
$('#pendingChallenges')[0].scrollTop = $(' #pendingChallenges')[0].scrollHeight;

最佳答案

您需要使用html而不是 text 将 html 字符串表示为 html 而不是 textcontent,这就是使用文本时发生的情况。

$('<div/>').text(message.text).prepend($('<em/>')
.html(...

关于javascript - 添加 jquery 附加链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20912902/

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