Has anyone implemented jQuery Mobile Add (+/-) But

2019-03-25 16:37发布

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:

enter image description here

5条回答
太酷不给撩
3楼-- · 2019-03-25 17:02
<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);
}
查看更多
疯言疯语
4楼-- · 2019-03-25 17:11

No just the slider input so far.

查看更多
老娘就宠你
5楼-- · 2019-03-25 17:12

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.

查看更多
The star\"
6楼-- · 2019-03-25 17:13

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.

查看更多
登录 后发表回答