Testing on Android 4.0.2 if I open a select menu and pick an option the change event fires ok but I have to click the done button of the menu to close the it. Is it possible to trigger this when an option has been selected? so far I've tried adding .focus() and .blur() to the body to shift focus but with no success.
This is the snippet of code I've been testing:
$('select').on('change', function(e){
console.log( $(this).find("option:selected").data('id') );
$('body').blur();
e.preventDefault();
});
Also jsfiddle: http://jsfiddle.net/dnRZc/5/
Try this it worked for me.
$('select').on('change', function(e){
$(this).blur();
e.preventDefault();
});
来源:https://stackoverflow.com/questions/12899330/how-to-automatically-close-mobile-select-box-when-an-option-change-event-is-fire