Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enter key does not get value after pressing. #453

Open
vanypham opened this issue Feb 12, 2023 · 0 comments
Open

Enter key does not get value after pressing. #453

vanypham opened this issue Feb 12, 2023 · 0 comments

Comments

@vanypham
Copy link

vanypham commented Feb 12, 2023

Hi Mervick,
Hope you are doing well and staying safe!
I am using your emojionearea in my project, which includes a chat application.
However, after pressing the Enter key from the message input, the value I got is empty.
Described as below:
I tried to hit the enter key after inputting the text, however, the result shows nothing from the first enter. I click outside of the input and click again inside of the input, then I hit Enter again, and it shows the value I typed.
So I want to get the value after the first Enter, not the second Enter by clicking out and in the field.
Can you help me with that?
The HTML code is below:
<form method="POST">
<input type="text" name="txt_message" id="messageText" class="form-control" placeholder="Type your message">
</form>

and the js is the following:
$(document).ready(function(){
$("#messageText").emojioneArea({
pickerPosition: "top",
events: {
keyup: function(editor, event) {

                   if (event.which === 13) {
                      var chat_message = $.trim($('#messageText').val());
                      alert(chat_message);

// var el = $("#messageText").emojioneArea();
// el[0].emojioneArea.setText('');

// event.preventDefault();
// return false;
}
}
}});

});

If you have a bit of time, please help me with solving this issue.
Thank you and appreciate it!
Regards,

Van

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant