Getting iPhone GO button to submit form

前端 未结 9 1750
轻奢々
轻奢々 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:52

    The code given by the others is correct. If you are using jQuery Mobile then add

    data-role="none" 
    

    to the submit input element. Like so:

    <input type="submit" data-role="none" style="visibility: hidden; position: absolute;" />
    
    0 讨论(0)
  • 2020-12-05 02:54

    As of writing (11/19/2019), on iOS 13.1.3, the following scenarios change the return key label:

    • The INPUT element must be wrapped in a FORM element, and the FORM element must have an action attribute. (It can be an empty string, i.e. action="".)
    • If the INPUT element has a type of search, the return key have a label of search.
    • Any other value for the type attribute will result in the return key having a label of go.

    The presence of an INPUT or BUTTON element with a type set to submit does not appear to affect the return key label. (Though it's a good idea to include one for accessibility purposes.)

    0 讨论(0)
  • 2020-12-05 02:55

    I could not work out why a very simple google maps form was not submitting using the iPhone Go button.

    Turns out, after stripping it down, it does not work with target="_blank" on the form tag.

    Removed that, and now the Go button works on iPhone.

    Here's a JSFiddle to try it

    0 讨论(0)
提交回复
热议问题