Safari中的HTML5日期字段和占位符文本

Safari中的HTML5日期字段和占位符文本

问题描述:

我遇到了一个问题,但我不确定这是不是我做错了,或者这个功能是否还不支持。

I've got an issue, but I'm not sure if it's something I'm doing wrong, or if this feature just isn't supported yet.

基本上我有以下几行代码:

Basically I have the following lines of code:

<input type="text" name="lastname" id="lastname" value="" placeholder="Last name" />

<input type="date" name="dob" id="dob" value="" placeholder="Date of birth" />

我已经在桌面版Safari上测试了这一点并且一切都很好,但是当我测试它时iPad,第二个输入不显示占位符文本。有谁知道iPad上的type =date是否支持占位符文字?

I've tested this on the desktop version of Safari and all good, but when I test it on the iPad, the second input doesn't show the placeholder text. Does anyone know if placeholder text is supported on type="date" on the iPad?

干杯
尼克

iPad正在做正确的事情。 占位符属性日期 上的输入元素不支持#input-type-attr-summary> 。它可能在桌面Safari上工作,因为它不支持 date 类型,因此该属性被忽略,并且您将留下纯文本字段。您可以检查DOM检查器。

The iPad is doing the correct thing. The placeholder attribute isn't supported on input elements on type date. It's probably working on desktop Safari because that doesn't support the date type, so that attribute is being ignored and you're left with a plain text field. You could check in the DOM inspector.