【问题标题】:Range input with value greater than 100值大于 100 的范围输入
【发布时间】:2017-10-18 17:23:31
【问题描述】:

我有以下代码:

document.querySelector('.target').value = 250;
console.log(document.querySelector('.target').value);
<input type="range" class="target">

控制台日志打印100 而不是250。为什么,以及如何解决这个问题?

【问题讨论】:

    标签: html input range


    【解决方案1】:

    您需要将max 属性设置为大于100 的默认值

    document.querySelector('.target').value = 250;
    console.log(document.querySelector('.target').value);
    <input type="range" class="target" max="250">

    【讨论】:

      猜你喜欢
      • 2020-05-16
      • 1970-01-01
      • 2011-05-22
      • 2013-05-30
      • 2018-04-23
      • 2018-12-04
      • 1970-01-01
      • 2012-04-17
      • 2016-12-12
      相关资源
      最近更新 更多