我使用的是 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/