Textarea change dom event that works without losing focus, for example, to be inserted with the mouse

I am creating a web page for translating texts in parts. The user must fill in a lot of text fields and click the "Save" button when this is done. The save button is inactive by default and becomes active when you press, press a key, and press a key. This, however, does not apply to the case when the text is inserted with the mouse, by right-clicking and clicking "Paste" or by middle-clicking (the "Middle-click" insert is common in X Windows). This insertion script is pretty common on the webpage I am creating.

The change event will work, but it only fires after losing focus on textarea. Is there a way to get the event associated with the mouse application that will be triggered immediately after the text changes?

Thanks!

+4
source share
1 answer
$("textarea").on("change keyup keydown paste cut copy", function(e) { // do something }); 

You can attach any event you want. Cut, copy and paste. I added them all!

+7
source

All Articles