jquery - changing bg color on min and max -
i want change color
of button-down
, button-up
when spinner
have min or max value red
<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>
you can apply change
method jquery ui spinner provides:
$('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(); });
Comments
Post a Comment