用户在移动端搜索框输入时即调起键盘上的搜索按钮

之前页面是有个 input 框,有个搜索按钮,一个取消按钮,后来产品搞了个产品优化的需求,就是调起键盘上的搜索按钮,就改呗......

之前那个搜索框就一个 input 框,如果能达到调起键盘的搜索就要像下面这么写:

<form action="" onsubmit="return false;">
    <input  type="search" value="" placeholder="搜索你想搜的" onsearch = "function(){}">
</form>

外面加了层form, input框的type变为search


猜你喜欢

转载自www.cnblogs.com/1rookie/p/9245454.html