I have $userMsg.text('@' + msg.user + ': ' + msg.txt)
, and I want to make the user's name clickable, so that, for example, I could direct the page to the user's profile. However, when I throw <a>
tags around msg.user
, it doesn't seem to work. How can I accomplish this?
答案 0 :(得分:0)
$.text()
就是那个 - 文字。相反,请使用.html()
:
$userMsg.html('<a href="' + user.profile + '">@' + msg.user + '</a>: ' + user.msg)