<input type=“search”> not working on iPhone Mobile Safari

后端 未结 2 1589
失恋的感觉
失恋的感觉 2021-01-12 10:14

Supposedly in HTML5 in Safari, you can define your input type as \"search\" and when the user starts typing, an X button will show up to allow them to clear, much like the G

相关标签:
2条回答
  • 2021-01-12 11:06

    That works in (Desktop) Safari, but not on the iPhone (Mobile Safari). You can mimic the functionality via some clever javascript.

    0 讨论(0)
  • 2021-01-12 11:16

    you need to make the type="search" attribute the first one in the tag - ie

    <input type="search" id="termsField" autocorrect="off" 
           placeholder="Type something here" />
    

    This bug has since been resolved for iphones but android browsers still need the search attribute first, otherwise it will be rendered as a standard input field.

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