jQuery Spinner - 从微调器中获取值

时间:2016-11-14 17:23:45

标签: javascript jquery jquery-ui-spinner

我正在使用jQuery Spinner,并且不知道如何从微调器获取值以在javascript代码中使用。

JS - 在单独的库中我需要调用值



function calculate (){
    var result = 15 * HERE I NEED VALUE! ;
   
 }

<div class="input-group spinner" data-trigger="spinner">
          <input type="text" class="form-control text-center" value="0" data-rule="quantity">
          <div class="input-group-addon">
            <a href="javascript:;" class="spin-up" data-spin="up"><i class="fa fa-caret-up"></i></a>
            <a href="javascript:;" class="spin-down" data-spin="down"><i class="fa fa-caret-down"></i></a>
          </div>
        </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:-2)

像这样的东西

$("#spinner")
  .spinner('delay', 200) //delay in ms
  .spinner('changed', function(e, newVal, oldVal) {
    // trigger lazed, depend on delay option.
  })
  .spinner('changing', function(e, newVal, oldVal) {
    // trigger immediately
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<script src="https://cdn.rawgit.com/vsn4ik/jquery.spinner/master/dist/js/jquery.spinner.min.js"></script>

<div data-trigger="spinner" id="spinner">
  <a href="javascript:;" data-spin="down">-</a>
  <input type="text" value="1" data-rule="quantity">
  <a href="javascript:;" data-spin="up">+</a>
</div>