1

我想将最小值或最大值更改为color红色button-downbutton-upspinner

<input type="hidden" name="id" value="<?= $this->product->getId() ?>" />
<input name="quantity" value="1" readonly/>

<script type="text/javascript">
    $(document).ready(function () {
        $('input[name="quantity"]').spinner({
            min: 1,
            max: <?= $this->product->getQuantity() ?>,
        }).keydown(function (e) {
            e.preventDefault();
        });
    });
</script>
4

1 回答 1

0

您可以应用changejquery ui spinner 提供的方法:

    $('input[name="quantity"]').spinner({
        min: 1,
        max: <?= $this->product->getQuantity() ?>,
        spin:function(event, ui){
           $(this).closest('.ui-spinner').find('a.ui-spinner-button').css('background', function(){
             this.value == 1 ? return 'red' : return '#e6e6e6';
           });
        }
    }).keydown(function (e) {
        e.preventDefault();
    });
于 2015-06-10T12:59:46.347 回答