Skip to content

Commit

Permalink
Use bind() instead of on() for keyup event handling, avoids multiple …
Browse files Browse the repository at this point in the history
…events firing when form popups opened multiple times.
  • Loading branch information
cheesegrits committed Jul 19, 2016
1 parent c2ff2d7 commit 6045ddf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions media/com_fabrik/js/autocomplete-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ define(['jquery', 'fab/encoder', 'fab/fabrik', 'lib/debounce/jquery.ba-throttle-

/**
* Using a 3rd party jQuery lib to 'debounce' the input, so the search doesn't fire until
* the user has stopped typing for more than X ms
* the user has stopped typing for more than X ms. Don't use on() here, use bind(), otherwise
* we get multiple events when form popups are opened multiple times.
*/
var self = this;
jQuery(document).on('keyup', debounce(this.options.debounceDelay, function (e) {
jQuery(this.getInputElement()).bind('keyup', debounce(this.options.debounceDelay, function (e) {
self.search(e);
}));

Expand Down
2 changes: 1 addition & 1 deletion media/com_fabrik/js/dist/autocomplete-bootstrap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6045ddf

Please sign in to comment.