Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define([
- "jquery",
- "bootstrap",
- ],
- function($)
- {
- "use strict";
- console.log(" ====== main.js is loaded====== ");
- $(document).ready(function()
- {
- $('<div class="quantity-nav"><div class="quantity-button quantity-up">+</div><div class="quantity-button quantity-down">-</div></div>').insertAfter('.quantity input');
- $('.quantity').each(function() {
- btnUp.on("click", function() {
- console.log("up");
- let newVal;
- let oldValue = parseFloat(input.val());
- if (oldValue >= max) {
- newVal = oldValue;
- } else {
- newVal = oldValue + 1;
- }
- spinner.find("input").val(newVal);
- spinner.find("input").trigger("change");
- });
- btnDown.on("click", function() {
- console.log("down");
- let newVal;
- let oldValue = parseFloat(input.val());
- if (oldValue <= min) {
- newVal = oldValue;
- } else {
- newVal = oldValue - 1;
- }
- spinner.find("input").val(newVal);
- spinner.find("input").trigger("change");
- });
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement