I have a select2 dropdown for countries (multiselect). When user types keywords, it shows the related items in the menu. For e.g., if user types ind, the menu shows
Why not simply use this code to check as there can be a mouse click :
$('#example').select2(); $("#example").on("click change keydown", function (e) { var keycode = (event.keyCode ? event.keyCode : event.which); if (keycode == 13) { console.log('inside') } });
Argentina Brazil China India Indonesia
Hope this helps.