【问题标题】:how to set minimum value in spinbox (fuelux)如何在 spinbox (fuelux) 中设置最小值
【发布时间】:2015-01-08 20:18:06
【问题描述】:

我正在尝试在 Fuelux 的 spinbox 组件中设置最小值。

我执行这段代码:

$('.spinbox').spinbox('min', 1);

但 Firefox 在 (fuelux.min.js) 中给了我这个错误:

TypeError: g[b] is undefined
..."fu.spinbox",g=new c(this,h)),"string"==typeof b&&(d=g[b].apply(g,e))});return v...

谁能帮帮我?

旋转框代码:http://getfuelux.com/javascript.html#spinbox-examples

【问题讨论】:

    标签: jquery twitter-bootstrap fuelux


    【解决方案1】:

    我已经调试了核心插件,发现发生了什么:

    在燃料 ux 的演示页面中,指南提供了以下代码:

    <div class="spinbox" data-initialize="spinbox" id="mySpinbox">
          <input type="text" class="form-control input-mini spinbox-input">
          <div class="spinbox-buttons btn-group btn-group-vertical">
            <button type="button" class="btn btn-default spinbox-up btn-xs">
              <span class="glyphicon glyphicon-chevron-up"></span><span class="sr-only">Increase</span>
            </button>
            <button type="button" class="btn btn-default spinbox-down btn-xs">
              <span class="glyphicon glyphicon-chevron-down"></span><span class="sr-only">Decrease</span>
            </button>
          </div>
        </div>
    

    但是当存在data-initialize="spinbox" 时,插件中存在错误。

    所以使用上面没有data-initialize="spinbox" 的html 代码,并使用您喜欢的选项初始化组件,如下所示:

    $('#mySpinbox').spinbox({
      'value': 1,
      'min' : 1
    });
    

    【讨论】:

      【解决方案2】:

      尝试在初始化时在选项对象中传递值:

       $('.spinbox').spinbox({
          value: '1,0px',
          min: 1,
          max: 10,
          step: 0.1,
          decimalMark: ',',
          units: ['px']
       });
      

      【讨论】:

      • 你前一天给出了答案,第二天他写了几乎一样的东西,并将自己的答案标记为有效。为你感到难过@Ragnar
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多