use onchange instead of onkeyup in this case
see http://www.w3schools.com/jsref/event_onchange.asp
eg.
<input type='text' value='abc' onchange='changeSomething(this);' />
to get around this
EDIT Two things:
1) Autocomplete values โโcan be selected using the arrow keys and the enter / tab, as well as with the mouse. The /enter.tab arrow keys fire onkeyup events ... clicking in the autocomplete field does not fire the onclick event.
2) The onchange event fires as soon as the focus is lost if the content has changed. Focus is not lost when auto-fill values โโare selected.
Essentially, there seems to be no way to reasonably guarantee that the event will be handled the way you want.
First, do you really need to listen to every keystroke? Secondly, would you rather turn off autocomplete? (e.g. <input type='text' value='abc' autocomplete='off' onkeyup='changeSomething(this);' /> )
Jonathan fingland
source share