Browse Source

fix/5812 (#5819)

* Check if the current target is a jQuery Object to check if the elements
are equals

* use a const for the search input

* improved the check if the search element is a jquery Object
Dustin Utecht 4 years ago
parent
commit
93a765eacf
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/bootstrap-table.js

+ 4 - 1
src/bootstrap-table.js

@@ -913,7 +913,10 @@ class BootstrapTable {
         return
       }
 
-      if (currentTarget === Utils.getSearchInput(this)[0] || $(currentTarget).hasClass('search-input')) {
+      const $searchInput = Utils.getSearchInput(this)
+      const $currentTarget = currentTarget instanceof jQuery ? currentTarget : $(currentTarget)
+
+      if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
         this.searchText = text
         this.options.searchText = text
       }