移动端把软键盘的换行变成搜索
作者:互联网
想把软键盘的换行换成搜索只需一步,在input标签外套上一个form表单即可
- <form action="">
- <input type="text" name="" placeholder="搜索" οnclick="clInput()" autofocus="autofocus"
- </form> document.onkeyup = function (e) { var code = e.charCode || e.keyCode if (code === 13) { onSearch() } }
标签:code,换行,软键盘,搜索,var,input 来源: https://www.cnblogs.com/wsj1/p/15094342.html