addEventListener('keydown',handlekeydown,false) vs. .onkeydown working differently for replacing typed keystroke
问题 I am using a 'keydown' event to replace specific characters typed in an input textbox. When I use: document.getElementById('inputText').onkeydown = handleInputTextKeydown; or the JQuery equivalent: $('#inputText').on('keydown',handleInputTextKeydown); I get the expected result - e.g. the keypress Shift+i displays as 'í'. However if I use addEventListner as the keydown hook: var tb = document.getElementById('inputText'); tb.addEventListener('keydown', handleInputTextKeydown, false); the input