The change event is not triggered when up/down key is pressed. So the change
event can be triggered on a key press.
js fiddle example for the code changes. Hope it helps.
EDIT 1 I checked with different browsers and found out that this problem is in firefox and hence the solution is for firefox. For chrome the fiddle in question works perfectly fine for me.
EDIT 2
My previous fiddle had change
triggered on keypress
. It seems firefox changed somethings and it no more works. I have updated the event to keyup
.