我在应用程序内部使用emojionearea。由于此插件隐藏了原始textarea
并使用div
来显示和加载表情符号,因此在执行onkeyup
和onkeypress
之类的事件时会引起问题。这是我的代码:
<textarea id="Message" class="form-control" cols="80" rows="7" onchange="SMSCounter(this, event, in_array([], "Source"))" onblur="RefineCounter(this, in_array([], "Source"))" onkeypress="SetChar(event)" onkeyup="SMSCounter(this, event, in_array([], "Source"))" maxlength="765" style="width: 350px; height: 100px; float: right; display: none;" name="data[Message]" data-rel="tmplButton-solh0ecqbs"></textarea>
答案 0 :(得分:1)
您可以在您所在区域的选项中使用事件,如下所示:
$("selector").emojioneArea({
events: {
keyup: function (editor, event) {
console.log('event:keyup');
},
keydown: function (editor, event) {
console.log('event:keydown');
}
}
)