Jquery 更改最小值和最大值上的背景颜色

Jquery 更改最小值和最大值上的背景颜色,jquery,jquery-ui-spinner,Jquery,Jquery Ui Spinner,当微调器的最小值或最大值为红色时,我想更改按钮向下和按钮向上的颜色 <input type="hidden" name="id" value="<?= $this->product->getId() ?>" /> <input name="quantity" value="1" readonly/> <script type="text/javascript"> $(document).ready(function () {

微调器
的最小值或最大值为红色时,我想更改
按钮向下
按钮向上
颜色

<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>
,
}).keydown(功能(e){
e、 预防默认值();
});
});

您可以应用jquery 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();
    });
$('input[name=“quantity”])。微调器({
民:1,,
马克斯:,
自旋:函数(事件、ui){
$(this).closest('.ui-spinner').find('a.ui-spinner-button').css('background',function()){
this.value==1?返回“红色”:返回“#e6”;
});
}
}).keydown(功能(e){
e、 预防默认值();
});

您可以应用jquery 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();
    });
$('input[name=“quantity”])。微调器({
民:1,,
马克斯:,
自旋:函数(事件、ui){
$(this).closest('.ui-spinner').find('a.ui-spinner-button').css('background',function()){
this.value==1?返回“红色”:返回“#e6”;
});
}
}).keydown(功能(e){
e、 预防默认值();
});

我想更改什么的颜色?上下按钮,对不起,我想更改什么的颜色?上下按钮,对不起,我想更改什么的颜色?上下按钮,对不起