1
我正在写一个聊天表情图标的点击功能。当我点击它时,它会被附加到我的textarea。从textarea我想把它发送到聊天。jquery点击追加功能聊天
了jQuery我写的东西:
$(".emoticon i").click(function() {
var e = $(this);
// $(".message").append ($(this).data('emoticon'));
console.log($(this).data('emoticon'));
$("#message").append() .attr(value('emoticon i'));
});
<div class="emoji hidden">
<div class="emoticon-box">
<div class="emoticons">
<div class="emoticon">
<div class="row">
<i class="em em-smiley"></i>
<i class="em em-smile"></i>
<i class="em em-blush"></i>
<i class="em em-relieved"></i>
<i class="em em-kissing_closed_eyes"></i>
<i class="em em-neutral_face"></i>
<i class="em em-sleeping"></i>
<i class="em em-flushed"></i>
</div>`enter code here`
我的texarea的Html。
<input id="message" type="text" placeholder="Type your message"></input>
你试过$(“。em”)。click()而不是$(“。表情符号i”)。 – mayk