mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-02 21:51:51 +08:00
Add tag on enter button
This commit is contained in:
parent
72a1c9b9bd
commit
168424a035
1 changed files with 4 additions and 1 deletions
|
@ -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(() => {
|
||||
|
|
Loading…
Reference in a new issue