Has anyone implemented jQuery Mobile Add (+/-) Button Number Incrementers?

廉价感情. 提交于 2019-12-04 18:15:19

问题


This seems like a "must have" form input for a mobile ui framework, but jQuery Mobile doesn't seem to have one.

Has anyone implemented a nice looking number Spinner form input that works well with the other jquery mobile form inputs?

Something like this:


回答1:


Probably well after the fact, but: http://dev.jtsage.com/jQM-Spinbox/ - based pretty much on what you show above, respects jQM themeing, min/max values.




回答2:


It's not exactly the same but an input with type="number" should give you an input field with two small buttons at the right (up & down).

You can check it here.




回答3:


No just the slider input so far.




回答4:


Found this: http://css-tricks.com/number-increment-buttons/




回答5:


<i onclick="qty('plus');" class="fa fa-plus c_pointer"></i>
<input type="text" id="prdqty" name="qty" value="1" placeholder="1">
<i onclick="qty('minus');" class="fa fa-minus c_pointer"></i>



function qty(val){
pqty = $('#prdqty').val();
if (val == "plus") {
      var newVal = parseFloat(pqty) + 1;
    } else {
    if (pqty > 1) {
      var newVal = parseFloat(pqty) - 1;
    } else {
      newVal = 1;
    }
}
$('#prdqty').val(newVal);
}


来源:https://stackoverflow.com/questions/10167232/has-anyone-implemented-jquery-mobile-add-button-number-incrementers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!