Javascript – keyup() bug in Firefox and Chrome


  var k = e.keyCode ? e.keyCode : e.which;          



    <input type="text" name=""  autocomplete="off"/>

Why keyup fires twice but only after second strike for special keys (arrows, space, backspace etc) ?
– Are any solutions to fix this issue?
– the autocomplete it's turned off
– In IE it is working fine
– With keydown or keypress is working fine for FF and Chrome
– But I can't use keypress because it doesn't work for IE for special keys
– I can't use keydown because I need the value of the input including the character I just type. Like this $(this).val(); – (I needed it for a live search). Keydown will give the value but without the last char. Maybe you could give me an idea in this direction – how to capture the value including last char with keydown?

Best Solution

Based on your question I'm a bit confused, will combining keyup and .val() not do what you want?


If not please elaborate a bit more.