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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -