2016-12-08 47 views
4

我正在使用剃须刀查看页面和日期时间字段中我想要显示占位符,它显示在Firefox中但不显示在铬显示 - 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" } }) 

Screenshot of firefox

Screenshot of chrome

我怎样才能解决这个问题?

+0

铬只允许“国际”日期格式。您的占位符需要为“YYYY/MM/DD”。此外,您只需使用'@'运算符来转义保留字(如'class') - 占位符不需要它。请参阅http://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format –

回答

0

日期类型不支持占位符属性。另外,WebKit实现表示它已经修复。呈现与一个`类型=“日期”`值输入时,默认情况下

​​