mervick / emojionearea

Emoji Picker Plugin for jQuery
https://jsfiddle.net/mervick/1v03Lqnu/765/
MIT License
953 stars 257 forks source link

function not working in event #360

Closed MJCodes2020 closed 5 years ago

MJCodes2020 commented 5 years ago

hello after submiting enter key , the text field is cleared but it nevers call the function SendMsg()

` $("#usermsg").emojioneArea({ inline: true, hidePickerOnBlur: true, tones: false, autocomplete: false,

events: {
keydown: function (editor, event) {
  var code = (event.keyCode ? event.keyCode : event.which);
  if (code == 13) { //Enter keycode
    //$("#chatform").submit();
        SendMsg(); // this is not working !
        $("div.emojionearea-editor").data("emojioneArea").setText('');
        $('#usermsg').val('');
    return false;
  }
}
}
});

//If user submits the form
function SendMsg(){
    var clientmsg = $("#usermsg").val();
    if(clientmsg != ''){
        $.post("chat.php", {chatinput: clientmsg});             
        $("#usermsg").attr("value", "");
    }
    $("#usermsg").focus();
}`
mervick commented 5 years ago

keydown event is not supported, please check all available events here https://github.com/mervick/emojionearea#events

mervick commented 5 years ago

ref https://github.com/mervick/emojionearea/issues/30