I'm listening to changes in a textbox using keyup
and change
as the events. This works when you type with the keyboard or do a copy paste also with the keyboard (Ctrl-V).
The problem is that when a user right-clicks on the textbox and pastes text, the change is not detected until the user clicks somewhere else on the page, and so things look broken. Here's the jsFiddle and here's the code:
function Start() {
$('#test').on({
change: OutputTxt,
keyup: OutputTxt
})
}
function OutputTxt() {
$('#output').text($('#test').val());
}
$(Start);
How do I change this so that a change that occurs with copy-paste is detected as soon as the pasting is done. Note: I tried adding a click event but it doesn't help.