Hi guys!
We are developing a website that has a webflow ecom on it. The goal is to add “+” and “-” buttons besides quantity input of the cart. As we press buttons, input value should change. Below is the script we are using:
minusButton.addEventListener(‘click’, event => {
event.preventDefault();
const currentValue = Number(inputField.value) 0;
inputField.value = currentValue - 1;
inputField.dispatchEvent(ev);
});
plusButton.addEventListener(‘click’, event => {
event.preventDefault();
const currentValue = Number(inputField.value) 0;
inputField.value = currentValue + 1;
inputField.dispatchEvent(ev);
});
const ev = new Event(‘input’, {bubbles: true, cancelable: true});
What we do:
- Connect to buttons https://tppr.me/Yfnyy;
- We get the “pressed” data but click on “+” and “-” does not work https://tppr.me/GxINb
Here is how the div where buttons, input and WF collection lives https://tppr.me/UjJ7E.
The question is how do we make these “+” and “-” buttons clickable?
We’ve already tried events like change, keyup, keydown, input, trigger, blur, submit, and in general all possible input events but it does not help. I’ve also searched through the forum and have found a topic on a similar issue https://tppr.me/MoaQk but it does not help as well
Here is my site Read-Only: LINK
(how to share your site Read-Only link)