<input type ="search">无法在iPhone Mobile Safari上运行

sxf*_*ynn 7 iphone search html5 input mobile-safari

据推测,在Safari的HTML5中,您可以将输入类型定义为"搜索",当用户开始输入时,会出现一个X按钮以允许它们清除,就像Safari中的Google搜索栏一样.在我的网站上,这适用于桌面Safari,但它在Mobile Safari中不起作用.

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

//This is the code for the X button I have to use now since HTML5 doesn't work
<INPUT type="image" name="Clear" alt="Clear" src="clearX.png" height="22" width="22"
        onClick="clearText(this)">
Run Code Online (Sandbox Code Playgroud)

起初我认为这是因为我有一个Jquery自动完成功能,#termsField但如果它在Desktop Safari中工作则不会是这种情况.有谁知道为什么会发生这种情况?此外,它在我的iPhone或XCode的iPhone模拟器中都不起作用,所以这不是我的iPhone特有的问题.

cee*_*yoz 6

这适用于(桌面)Safari,但不适用于iPhone(Mobile Safari).您可以通过一些聪明的JavaScript 来模仿功能.