【问题标题】:Placeholder not working in chrome占位符在 chrome 中不起作用
【发布时间】:2017-04-23 08:33:25
【问题描述】:

我正在使用 razor 视图页面,我想在日期时间字段中显示占位符,它在 Firefox 中显示,但在 chrome 中不显示它的显示 - mm/dd/yyyy

她是我的密码 -

 @Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control form-inline", @placeholder = "Date must be today's or past date" } })

我该如何解决这个问题??

【问题讨论】:

  • Chrome 默认情况下,在使用 type="date" 值呈现输入时仅允许“国际”日期格式。您的占位符必须是 YYYY/MM/DD。此外,您只需要使用@ 运算符来转义保留字(如class) - 占位符不需要它。见stackoverflow.com/questions/7372038/…

标签: html placeholder asp.net-placeholder


【解决方案1】:

日期类型不支持占位符属性。此外,WebKit 实现表示已修复。

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary

【讨论】:

    猜你喜欢
    • 2018-01-17
    • 2018-02-19
    • 2013-10-19
    • 2013-07-15
    • 2016-05-18
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多