javascripthtmlemojione

Emojione area causes problem executing hidden textarea events


I'm using emojionearea inside my application. Since this plugin hides original textarea and uses div instead to show and load emojis, it causes problems in executing events like onkeyup and onkeypress. Here is my code:

<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>

Solution

  • You can use the events in options for your area like this:

    $("selector").emojioneArea({
      events: {
        keyup: function (editor, event) {
         console.log('event:keyup');
        },
        keydown: function (editor, event) {
          console.log('event:keydown');
        }
      }
    )