Skip to content

Instantly share code, notes, and snippets.

@peterwegren
Last active August 26, 2022 22:38
Show Gist options
  • Save peterwegren/bc19b0654652d9202119505c828c7aae to your computer and use it in GitHub Desktop.
Save peterwegren/bc19b0654652d9202119505c828c7aae to your computer and use it in GitHub Desktop.
Prevent auto-focus on Select2 search input (prevents keyboard popup on Android).
// prevent auto-focus on select2 search input
$(document).ready(function(){
$('select').on('select2:open', function() {
$('.select2-search input').prop('focus', 0);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment