fix slow typing caused clear show/hide
This commit is contained in:
parent
31e39ab988
commit
e6224d3f0c
@ -68,14 +68,24 @@ $(function(){
|
||||
},
|
||||
|
||||
//show / hide clear button
|
||||
toggleClear: function() {
|
||||
toggleClear: function(e) {
|
||||
if(!this.$clear) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.$input.val().length) {
|
||||
//arrows, enter, tab, etc
|
||||
if(~$.inArray(e.keyCode, [40,38,9,13,27])) {
|
||||
return;
|
||||
}
|
||||
|
||||
var len = this.$input.val().length,
|
||||
visible = this.$clear.is(':visible');
|
||||
|
||||
if(len && !visible) {
|
||||
this.$clear.show();
|
||||
} else {
|
||||
}
|
||||
|
||||
if(!len && visible) {
|
||||
this.$clear.hide();
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user