You can add an alert statement inside the click event handler to check if the .qq_qty value is equal to 5. If it is, display an alert message.

Here's an example of how you can modify the existing code:

$(document).on('click', '.qq_item_plus', function() {
    var qty_input = $(this).closest('.qcart_item').find('.qq_qty');
    var qty_val = parseFloat(qty_input.val());

    if (qty_val < 5) {
        qty_input.val(qty_val + 1);
    } else {
        alert("Max quantity is 5.");
    }

    qq_caculate_product();
});

In this code, qty_input variable is used to store the jQuery object of the .qq_qty input element. The if condition checks if qty_val is less than 5. If it is, the value is incremented by 1. Otherwise, an alert message is displayed

$documentonclick qq_item_plus function var qty_val = parseFloat$thisclosestqcart_itemfindqq_qtyval;			ifqty_val 0 	$thisclosestqcart_itemfindqq_qtyvalparseFloatqty_val + 1;			qq_caculate_product

原文地址: https://www.cveoy.top/t/topic/iwv9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录