vendredi 20 novembre 2015

select checkbox based on value and disable remaing in grid view

$(document).on('change', ".serialnotd", function () {
    var count = $("[type='checkbox']:checked").length;
    var qty = $(this).parent().children().find('.recqantity').val();
    var isssue_qty = parseInt(qty);
    var select_qty = parseInt(count);
    if (select_qty > isssue_qty) {
        alert("Selected no's. must be equal to  Qty");
    }
    if (select_qty >= isssue_qty) {
        $('input[type=checkbox]').not(':checked').attr("disabled", true);
    } else {
        $('input[type=checkbox]').not(':checked').attr("disabled", false);
    }
})

if i have (.recqantity) value = 2. Need to allow check only 2 check box not more or less of (.recqantity)value (.serialnotd) and (.recqantity) are in grid view need to check for each and every row need to done before submit (type = 'submit'). Even tried wit each(). Still Lack of luck




Aucun commentaire:

Enregistrer un commentaire