Changed code to use 'input' event instead of 'keydown change', as it fixes pasting.