Answer the question
In order to leave comments, you need to log in
The input does not work on the phone, but on the computer it works, what should I do?
$(".cart-info__promo").on("keyup", (function () {
var t;
if (t = $(this).val(), $.ajax({
type: "GET",
url: "../db/promo.php",
data: {
promocode: t
},
async: !1,
dataType: "json",
success: function (t) {
s = t
}
}), "true" == s.isCorect) {
if (o.isPromo) return;
$(".cart-info__price-price").addClass("promo-done"),
o.promo = o.price * (1 - s.procent / 100),
$(".cart-info__price-promo").text(`$ {
o.promo
}
$ {
o.currency
}`),
o.isPromo = !0
} else $(".cart-info__price-price").removeClass("promo-done"),
$(".cart-info__price-promo").text(""),
o.isPromo = !1
}))
Answer the question
In order to leave comments, you need to log in
keyup event doesn't work on mobile, add input:
$(".cart-info__promo").on("keyup input", (function () {
var t;
if (t = $(this).val(), $.ajax({
type: "GET",
url: "../db/promo.php",
data: {
promocode: t
},
async: !1,
dataType: "json",
success: function (t) {
s = t
}
}), "true" == s.isCorect) {
if (o.isPromo) return;
$(".cart-info__price-price").addClass("promo-done"),
o.promo = o.price * (1 - s.procent / 100),
$(".cart-info__price-promo").text(`$ {
o.promo
}
$ {
o.currency
}`),
o.isPromo = !0
} else $(".cart-info__price-price").removeClass("promo-done"),
$(".cart-info__price-promo").text(""),
o.isPromo = !1
}))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question