JSFiddle - React, Tailwind, and code Playground

by Neal

HTML

<textarea></textarea>

JavaScript

$.fn.pressEnter = function(fn) {  
  
    return this.each(function() {  
        $(this).bind('enterPress', fn);
        $(this).keyup(function(e){
            if(e.keyCode == 13)
            {
              $(this).trigger("enterPress");
            }
        })
    });  
 }; 


$('textarea').pressEnter(function(){alert('here')})