在旧版本的 Firefox(直到 109)中,可以像 Chromium 一样选择日期选择器的图标:
input[type="date"]::-webkit-calendar-picker-indicator {
display: none; /* Hides the icon in Chrome and Firefox < v109 */
}
这样就不再可能了,另请参阅这个代码笔。现在有人有解决方法吗?
我的日期输入有自定义图标,现在在新的 Firefox 版本中显示其中两个图标。现在,我正在执行一些用户代理嗅探并添加 CSS 类,以便我可以删除自定义图标:
const userAgent = navigator.userAgent;
const regex = /Firefox\/(?<majorRelease>\d+(\.\d+)?)/
const match = userAgent.match(regex)
const FirefoxVersion = match ? Number(match.groups.majorRelease) : null
if (FirefoxVersion > 108){
const inputs = document.querySelectorAll('.input[type="date"]')
inputs.forEach((el)=>{
el.classList.add('input-date-firefox-fix')
})
}
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)