fix slow typing caused clear show/hide
This commit is contained in:
@ -68,14 +68,24 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
//show / hide clear button
|
//show / hide clear button
|
||||||
toggleClear: function() {
|
toggleClear: function(e) {
|
||||||
if(!this.$clear) {
|
if(!this.$clear) {
|
||||||
return;
|
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();
|
this.$clear.show();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if(!len && visible) {
|
||||||
this.$clear.hide();
|
this.$clear.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user