Prevent select2 from opening when a tag is clicked
问题 This question evolved into preventing the dropdown from opening on enter key press. As you can see, my ugly solution closes the dropdown with a setTimeout when you press enter when a tag input has focus. How can I prevent it from opening at all on enter, instead of closing it after it has opened? Here are some events that may be useful: https://select2.org/programmatic-control/events var tagClick = false; $(document).on('mousedown touchstart', '.tag', function(e) { var $self = $(this);