iOS上的"输入类型=日期"占位符?

Dav*_*vid 5 iphone html5 placeholder

我目前正在开发一个针对iPhone/iPad的网站.

将输入类型设置为日期会将字段外观更改为下拉菜单,并且使用文本字段的占位符属性仅显示在桌面版本上,而不显示在iphone上.有没有解决的办法?

这就是它目前的样子; http://i44.tinypic.com/2u91xsz.png

我想摆脱那个结束日期文本,并有类似于它上面的下拉菜单.

它基本上只是让我可以让用户知道他们输入了什么,而不需要在屏幕上使用任何额外的空间,所以如果没有解决方案,它不是最大的问题.

Dal*_*y S 5

我花了一段时间才弄清楚这个问题,将其保留为 type="text",然后添加 onfocus="(this.type='date')"

我什至喜欢我看到的onblur

<input placeholder="Date" class="textbox-n" type="text" onfocus="(this.type='date')" onblur="(this.type='text')" id="date">
Run Code Online (Sandbox Code Playgroud)


Jas*_*onw 2

与文本字段一起使用的占位符属性仅显示在桌面版本上,而不显示在 iPhone 上。有没有解决的办法?

尝试使用 javascript 和 css。

<div id="closing_date">
<label for="closing_date_field" class="overlabel">Closing Date</label>
<input id="closing_date_field" type="date" name="closing_date">
</div>
Run Code Online (Sandbox Code Playgroud)

请参阅此处的代码