我正在处理一个我无法弄清楚的奇怪的格式错误。在其他人的帮助下,我有一个小函数,它用指向实际 Twitter 用户的链接替换字符串中的所有 @[user]。它工作得很好,但是一旦我将它添加到我的网页中,它就开始有点吓人了。
这是字符串的示例。
If you want these foams Ima give you the chrome <a href="https://twitter.com/WillThaRapper" target="_blank">@WillThaRapper</a>
但是,一旦我将它附加到<p>要在页面上显示的元素,它看起来像这样。
If you want these foams Ima give you the chrome <a href="https://twitter.com/WillThaRapper" target="_blank">@WillThaRapper</a>
我很难弄清楚这一点。