I'm building an application that uses a barcode reader for input. The application uses a <select>
element for changing between scan modes.
If a user opens the mode selection menu, but then chooses the same mode they are in presently, then I cannot blur the <select>
using the following:
$("#mode-select").change(function() {
//switch the mode
//...
$(this).blur();
});
This becomes problematic due to the scanner input. The scanner acts as a keyboard, and ends a successful scan by submitting a return character. If the <select>
has focus this opens the mode selection menu unexpectedly, causing people to call my office.
Illustration here: select any new value and the <select>
loses focus. Select the same value and it does not. I would like it to lose focus regardless.
How can I blur the <select>
in this instance, or otherwise implement similar behavior?