Extract function onInput to try to make it work on IE8