【问题标题】:css disable button not working in tabletscss禁用按钮在平板电脑中不起作用
【发布时间】:2020-03-26 06:27:40
【问题描述】:

-我有一个按钮: -我想用javascript禁用它: document.getElementById("input-datestart").disabled = true; -css:

input:disabled {
    background-color: #fff!important;
    color: #000;
}

文字颜色 [颜色:#000;] 在我的电脑浏览器上它可以工作,但在平板电脑上,它不工作, 请在图片下方找到 enter image description here

【问题讨论】:

标签: javascript css button mobile disable


【解决方案1】:

您可以将它用于多个操作系统。

使背景和文本在屏幕上可见,我在您的小提琴中观察到的是 transparent 供用户使用,因此请随意修改颜色代码以使其在 devicesplatforms 之间保持一致。

document.getElementById("input-datestart").disabled = true;
  input:disabled {
  -webkit-text-fill-color: #880000;
  /* Override iOS / Android font color change */
  -webkit-opacity: 1;
  /* Override iOS opacity change affecting text & background color */
  color: #880000;
  /* Override IE font color change */
<!DOCTYPE html>
<html>

<head>
  <title>Page Title</title>
</head>

<body>

  <input value="text value" name="datePlan" id="input-datestart" readonly="" type="text">

</body>

</html>

【讨论】:

  • 很高兴能为您提供帮助!如果值得投票,请投票!谢谢
【解决方案2】:

请尝试使用 webkit 前缀和 CSS 属性,我希望它适用于 Android 平台

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-24
    • 2020-12-13
    • 1970-01-01
    • 2012-02-14
    • 1970-01-01
    • 2014-09-08
    • 1970-01-01
    相关资源
    最近更新 更多