Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Fix of search when tabbing in
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminNeilDavis committed Jan 5, 2015
1 parent 83fafc2 commit df46fa2
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,21 @@
if (e.which === 13) {
e.preventDefault();
this.action();
} else {
}
else if (e.which === 9) {
e.preventDefault();
}
else {
val = this.$input.val();
if(!val){
this.clear();
}else if(val!==this.activeSearch){

if(val!==this.activeSearch){
this.$icon.removeClass(remove).addClass(search);
if(val) {
this.$element.removeClass('searched');
}
else if (this.options.clearOnEmpty){
this.clear();
}
}else{
this.$icon.removeClass(search).addClass(remove);
}
Expand Down Expand Up @@ -156,7 +165,9 @@
return ( methodReturn === undefined ) ? $set : methodReturn;
};

$.fn.search.defaults = {};
$.fn.search.defaults = {
clearOnEmpty: false
};

$.fn.search.Constructor = Search;

Expand Down

0 comments on commit df46fa2

Please sign in to comment.