0
I have a responsive page to make an e-commerce and have the following code to add or remove quantity:
// HTML
<a class="menos" class='fas fa-minus-circle'><i></i></a>
<p class="qtde">0</p>
<a class="mais" class='fas fa-minus-circle'><i></i></a>
// jQuery (estou usando o jQuery comum e não o jQuery mobile):
$(document).on('click', '.menos', function() {
// Retira quantidade
});
$(document).on('click', '.mais', function() {
// Soma quantidade
});
On PC and android phones worked. No iPhone worked on Safari or Chrome.
In other posts here in the forum suggested to add to the click the touchstart function and also use mousedown instead of click and it was like this:
$(document).on('click touchstart', '.mais', function() {
// Soma quantidade
});
// ou
$(document).on('mousedown touchstart', '.mais', function() {
// Soma quantidade
});
On the regular PC.
On Android he ran the function twice in a row (0-2-4 ...).
On the iPhone there, it worked on an iPhone X in both Safari and Chrome but it didn’t work on an iPhone 7 Plus in both Safari and Chrome, all devices are up to date and apps in the same version.
How can I proceed?
Use
button
in place ofa
. The taga
is used for navigation and not to change elements.– Sam
Hello @Sam, it really worked too! I just had to modify the CSS but it did too! Thank you very much!
– Donadon