onchange is triggered whenever you blur the input field, which you do when you click your other field. Simplest to remove the onchange event, though you could give it a timeout and cancel it when the other field is focused.
I’m not sure if my explanation was clear enough for you to understand it. I click in the input field, I then type in a few letters, like Mill, and then I click on the displayed é letter above. It should add this é letter in the input field so as to have Millé, and it should not do any blur nor change, because I wish to finish typing in my word, so as to have in the input field the word Millésime, and then I can click to the next field, triggering the onchange and see the ajax correction.
The onchange event will be triggered before the onclick handler is performed :
1°) user is writing in the input field
2°) user clicks on the mini keyboard
3°) input field lose focus
4°) input field’s onchange event is triggered
5°) mini keyboard has focus
6°) mini keyboard’s onclick handler is performed
Which shows me you clearly understood the problem from the start.
Following up on your two suggestions, if I remove the onchange event handler, then how would I handle changes if the on screen keyboard is not used ?