I have an input field:
<input type="text" id="awesome-input" />
And I'd like to do an action when the user hits enter:
$("#awesome-input").on('keydown',function(e){
if(e.which == 13)
console.log("did stuff!");
}
However , I'd also like to do the same action when a mobile user hits "ok" after typing on a touch screen. My first thought was the submit
event, but that only works if I wrap it in a form, which I'd rather not do.
事实证明,到目前为止,我尝试过的所有电话都会触发一次点击事件,其中e.which == 13
,因此实际上它已经可以工作了。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.