From a39fc87ec6d2a3f14145ab7f9f59ba99cee70ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis=20Elmeris?= Date: Tue, 5 Nov 2019 13:36:37 +0200 Subject: [PATCH] danielfarrell/bootstrap-combobox#268 Properly detect clicking on the current combobox --- js/bootstrap-combobox.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/bootstrap-combobox.js b/js/bootstrap-combobox.js index 24f75df..2932515 100755 --- a/js/bootstrap-combobox.js +++ b/js/bootstrap-combobox.js @@ -278,10 +278,12 @@ } , scrollSafety: function(e) { - if (e.target.tagName == 'UL') { - this.$element.off('blur'); - } + var closestUl = $(e.target).closest('ul'); + if (closestUl.length > 0 && closestUl[0] === this.$menu[0]) { + this.$element.off('blur'); + } } + , clearElement: function () { this.$element.val('').focus(); }