html - 如何删除 Chrome 27 中日期时间本地 HTML 输入上的蓝色十字?

标签 html google-chrome datetime input

我使用的是 datetime-local 输入,但自 Chrome v27 以来,出现了一个蓝色十字,允许清除所选的日期时间。 我不想要它,回到我们对 chrome 26 的输入。

这是我定义输入的方式:

<input  type="datetime-local" value="1985-04-12T23:20:50.52"/>

在这个jsFiddle中查看. 用Chrome 27打开可以看到蓝色十字

你知道如何去除这个蓝色十字吗?

编辑:

作为临时解决方法,如果清除了新值,我会通过重置值来禁用蓝十字功能 (see it in JSFiddle)

$('input#testInput').on('change', function(event)
{    
    var newValue = $('input#testInput').val();
    if(!newValue || newValue === "")
    {
        $('input#testInput').val(lastValue);
    }
    else
        lastValue = newValue;
});

它并不能真正满足最初的需求,所以我仍在寻找一个好的解决方案。

最佳答案

这是删除十字和箭头的方法:

input::-webkit-outer-spin-button, /* Removes arrows */
input::-webkit-inner-spin-button, /* Removes arrows */
input::-webkit-clear-button { /* Removes blue cross */
  -webkit-appearance: none;
  margin: 0;
}

关于html - 如何删除 Chrome 27 中日期时间本地 HTML 输入上的蓝色十字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16688417/

相关文章:

html - Hpple,在 </span> 之后获取文本

javascript - 使用 innerHTML 更改 iframe 的内容时不执行脚本

node.js - 我可以在我的 Chrome 打包应用程序中使用 socket.io 吗?

python - 将数据类型系列转换为日期时间

jquery - <a> 的下载属性的替代实现

html - 焦点时表单输入的图标消失

safari - Google Chrome浏览器显示的页面是否与Safari相同?

google-chrome - Google Chrome for IOS 6 ajax 文件上传进度事件不起作用

php - 在 PHP 中获取一周的第一天?

javascript - 使用 JavaScript 将 ISO 日期转换为 UTC 时间