Getting iPhone GO button to submit form

前端 未结 9 1814
轻奢々
轻奢々 2020-12-05 02:08

Is anyone aware of what variables go into a form to make the iPhones virtual keyboard\'s GO button submit the form vs. not?

I\'ve been trying to narrow down the scen

9条回答
  •  执念已碎
    2020-12-05 02:43

    You can also bind a keypress listener to the element or form. The iphone "Go" button is the same as the enter button on a computer, char 13.

    $('someElem').bind("keypress", function(e){
        // 'Go' key code is 13
        if (e.which === 13) {
           console.log("user pressed Go");
           // submit your form with explicit JS.
        } 
     });
    

提交回复
热议问题