Skip to content

Instantly share code, notes, and snippets.

@libo1106
Created February 25, 2013 10:47
Show Gist options
  • Save libo1106/5029072 to your computer and use it in GitHub Desktop.
Save libo1106/5029072 to your computer and use it in GitHub Desktop.
搜索框提示按钮
/* 搜索框 */
if( $('.search').length != 0){
var search = $('.search');
var search_enter = $('.search_enter');
search_enter.hide();
search.on({
keyup : function(){
console.log('keyup');
search.val().length != 0 ? search_enter.show() : search_enter.hide();
},
change : function(){
console.log('change');
search.val().length != 0 ? search_enter.show() : search_enter.hide();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment