【问题标题】:How to hide the popup calendar of <input type="date"> in Firefox?如何在 Firefox 中隐藏 <input type="date"> 的弹出日历?
【发布时间】:2020-12-07 22:14:18
【问题描述】:

在 Firefox 中,input type="date" 在单击时会弹出一个日历。除了阻止单击时的默认行为外,我还没有找到隐藏日历的方法。我也不想使用type='text'

有没有办法在 Firefox 中隐藏这个弹出式日历?

【问题讨论】:

    标签: html css firefox calendar popup


    【解决方案1】:

    input::-webkit-calendar-picker-indicator{
        display: none;
    }
    &lt;input type="date" /&gt;

    【讨论】:

    • 我在旧版本的 Firefox 上进行了测试。需要多次更新才能达到当前版本。我在每个更新阶段都测试了这个 sn-p。这对我在以下任何版本中使用 Firefox 都不起作用,包括最新版本:37.0.1、43.0.1、47.0.2、56.0、72.02(显示日历)、80.0(显示日历)
    【解决方案2】:

    如果您阻止 onClick 处理程序的默认操作,则弹出窗口不会显示在 Firefox 上。

    &lt;input type="date" onClick="event.preventDefault()" /&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-18
      • 1970-01-01
      • 2016-02-24
      • 2016-11-25
      • 1970-01-01
      • 2014-11-20
      • 2020-08-02
      • 1970-01-01
      相关资源
      最近更新 更多