0

Почему, если я таблицу подгружу через ajax, то событие change не видит?

$(document).ready(function() {
    $('.clothes table .checkbox input[type="checkbox"]').on("change", function() {
        alert('sdfsdf');
        var valp = 0;

        $(this).closest('.clothes table').find('.checkbox').each(function() {
            if ($(this).find('input[type="checkbox"]').prop("checked") && $(this).find('input[type="checkbox"]').val() > 0) {
                valp = Number.parseInt(valp) + Number.parseInt($(this).find('input[type="checkbox"]').val());
            }
        });

        if (valp > 0) {
            $('.calc-box').addClass('active');
            $('.calc-box dt').html(valp);
        } 
        else {
            $('.calc-box').removeClass('active');
        }
    });
});

код по выводу данных через ajax

$('#price_direct_s').on("change", function() {
    var valp = $(this).val();
    price_show(valp);
});

function price_show(valp) {
    $.post("assets/ajax.php", {
            act: "pricep",
            idprogramm: valp
        })
        .done(function(data) {
            if (data) {
                $('.clothes table tbody').html(data);
            } else {
                $('.clothes table tbody').html('<tr><td colspan="5" data-title="Наименование">На данный момент информация отсутствует</td></tr>');
            }

        });
}
6

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.