Отловить значение
Помогите пожалуйста изменить скрипт. Есть такой блок увеличения-уменьшения количества и есть переменная smarty {$maximum}.
Нужно чтобы при достижении $maximum в поле input, например блокировалась кнопка .rs-dec <div class="cat-product-quantity rs-product-amount"> <div class="quantity"> <input type="number" step="{$product->getAmountStep()}" value="{$product->getAmountStep()}" name="amount" class="rs-field-amount"> <div class="quantity-nav rs-unit-block"> <div class="quantity-button quantity-up rs-inc" data-amount-step="{$product->getAmountStep()}"></div> <div class="quantity-button quantity-down rs-dec" data-amount-step="{$product->getAmountStep()}"></div> </div> </div> </div> <script> $('.rs-product-amount .rs-inc').off('click').on('click', function() { var amountField = $(this).closest('.rs-product-amount').find('.rs-field-amount'); amountField.val( (+amountField.val()) + ($(this).data('amount-step')-0) ); }); $('.rs-product-amount .rs-dec').off('click').on('click', function() { var amountField = $(this).closest('.rs-product-amount').find('.rs-field-amount'); var val = (+amountField.val()); if (val > $(this).data('amount-step')) { amountField.val( val - $(this).data('amount-step') ); } }); </script> |
Часовой пояс GMT +3, время: 15:00. |