Add tag on enter button

This commit is contained in:
Anton Ignatov 2019-05-07 14:47:44 +02:00
parent 72a1c9b9bd
commit 168424a035

View file

@ -145,12 +145,15 @@ $.fn.extend({
$('.select2').find('input, .select2-selection__rendered').off('keydown').on('keydown', function(e) {
var activeElement = $('.select2-results .arrow_pointer');
var firstElement = $('.select2-results .select2-results__option').first();
var groupElement = activeElement.find('.select2-results__group');
if (e.keyCode === 13) {
if (groupElement.length > 0) {
groupElement.click();
} else {
} else if (activeElement.length > 0) {
activeElement.mouseup();
} else {
firstElement.mouseup();
}
setTimeout(() => {