单击输入类型=搜索时重置按钮的任何事件?
Any event for reset button on click of input type=search?
html5 搜索输入元素上出现点击重置按钮是否有可用的事件?
活动名为 search
。它在两个方面被触发:搜索和重置。
您只需要检查查询是否为空即可。
例如:
$("#searchInput").on("search", function(evt){
if($(this).val().length > 0){
// the search is being executed
}else{
// user clicked reset
}
});
有效,这是 fiddle:https://fiddle.jshell.net/ye1dabap/
html5 搜索输入元素上出现点击重置按钮是否有可用的事件?
活动名为 search
。它在两个方面被触发:搜索和重置。
您只需要检查查询是否为空即可。
例如:
$("#searchInput").on("search", function(evt){
if($(this).val().length > 0){
// the search is being executed
}else{
// user clicked reset
}
});
有效,这是 fiddle:https://fiddle.jshell.net/ye1dabap/