To be convenient with the modification of the text caused by the user dragging another text / elements inside the text field or the insertion text inside it, you need to listen to change
.
In addition, I suggest using the .on()
method, available with jQuery 1.7, and defining the input key pressed by the user through the event.which
property of the event object to have solid cross-browser behavior for your application:
var $textarea = $('#comment');
Emanuele del grande
source share