禁用新的Chrome日期类型输入格式和占位符 [英] Disable new Chrome date types input formatting and placeholder

查看:162
本文介绍了禁用新的Chrome日期类型输入格式和占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新版本的Chrome终于支持原生输入的日期类型,这很好,但是强制自己的日期格式和占位符文本,这并不能很好地适应我的布局。如何删除本地化的日期格式,因此它显示为ISO(它 off课程以ISO形式发送,但只是未在浏览器中显示),以及如何删除本地化的占位符(日期类型不支持占位符属性介意你,所以它不能只是简单地重写)?

The newest version of Chrome finally supports the date types input natively, which is just fine, but it is forcing its own date formatting and placeholder text, that doesn't suite my layout very well. How to remove the localized date formatting, so it displays as ISO (it is off course sent as ISO, but just not displayed that way in the browser), and how to remove the localized placeholder (date types do not support placeholder attribute mind you, so it can't just be simply overridden)?

编辑:我可以只占位符样式背景的颜色,但有没有什么hacky?

I could just style the placeholder as the color of background, but is there anything less hacky?

推荐答案

这个问题涵盖了如何在chrome中设置(伪)元素的样式,并且据我所知可以告诉请详细说明您使用最新版Chrome浏览器所具有的全部控制权(截至撰写时的第27版)。

This question covers how to style the (pseudo) elements in chrome and as far as I can tell the ones detailed there are all the control you have with the latest version of chrome (v27 as of writing).

日期格式(例如dd / mm / yyyy)始终设置为浏览器语言环境设置。

Date format (eg. dd/mm/yyyy) is always set to browser locale settings.

如果您想要更多的控制,唯一的其他选择是使其type ='text'和一个dd一个JavaScript日期选择器。一些polyfills允许您用JS解决方案覆盖浏览器样式。

If you want more control the only other option is to make it type='text' and add a JavaScript datepicker. Some polyfills allow you to override the browser style with the JS solution.

这篇关于禁用新的Chrome日期类型输入格式和占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆