jquerytwitter-bootstrapfuelux

how to set minimum value in spinbox (fuelux)


I'm trying to set minimum value in the spinbox component of fuelux.

I execute this code:

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

but Firefox give me this error in (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...

Can anyone help me ?

spinbox code: http://getfuelux.com/javascript.html#spinbox-examples


Solution

  • i have debug the core plugin and found what is happen:

    in the demo page of fuel ux, the guide provide this code:

    <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>
    

    but there is a bug in the plugin when data-initialize="spinbox" is present.

    So use the html code above without data-initialize="spinbox" and initialise the componenent with your prefered options like this:

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