是否可以禁用input = time clear按钮 [英] Is it possible to disable input=time clear button

查看:173
本文介绍了是否可以禁用input = time clear按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 input = time 上选择时间时限制用户输入。
所以可以从输入中禁用小清除按钮吗?

I am trying to restrict users input when selecting time on input=time. so is it possible to disable the small clear button from the input?

推荐答案

您所有最新的直接解决方案浏览器可能是:

Your straight-forward solution for all up-to-date browsers could be:

input[type="time"]::-webkit-clear-button {
    display: none;
}

如果您愿意仅为Internet Explorer 10指定它,您应该设置样式它带有

:: - ms-清除伪元素

If you're willing to specify it only for Internet Explorer 10 you should style it with
::-ms-clear pseudo-element:

input[type="time"]::-ms-clear {
    display: none;
}

你也可以用宽度输入元素的c $ c>和 height

input::-ms-clear {
    width: 0;
    height: 0;
}

如果您只想将其应用于带文字类型的输入:

If you want to apply it only to input with text type:

input[type=text]::-ms-clear {
    display: none;
}



编辑1:



如果它不起作用,那么你必须确保在F12工具中没有选择IE10 / Standard以外的浏览器/文档模式!

此外,您可能会发现其他有趣的伪控件:

Additionally you might find other pseudo-controls interesting:

/* Hide the cancel button */
::-webkit-search-cancel-button { 
    -webkit-appearance: none; 
}

/* Hide the magnifying glass */
::-webkit-search-results-button {
     -webkit-appearance: none; 
}

/* Remove the rounded corners */
input[type=search] { 
    -webkit-appearance: none; 
}

这篇关于是否可以禁用input = time clear按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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