When I add a survey item in Cart Attribute, sometimes the input result is not reflected. What is the cause?
The checkout button is designed not to proceed unless it is entered.
Is this an effect of this? We are waiting for your answer!
{%- when 'survey' -%}
※○○○○○○○
ーーーーーーーーーーー
$(function () {
const textFields = $("input[type=text]");
const checkoutButton = $(".cart__checkout-button");
updateButtonState();
textFields.on("keyup", updateButtonState);
function updateButtonState() {
let allFieldsFilled = true;
textFields.each(function () {
if ($(this).val().trim() === "") {
allFieldsFilled = false;
return false;
}
});
if (allFieldsFilled) {
checkoutButton.removeAttr("disabled");
} else {
checkoutButton.attr("disabled", "disabled");
}
}
});