lundi 10 février 2020

jquery checkbox for approve and reject

i have created a logic in which i have to approve and reject users...

but issue is say, when i approve 2 users now but i have to reject 1 user and when i do the checkbox(approve)of other gets unchecked

and when i use "id" the logic only works for 1st entry and when use "class" it works for all at once

what can be the correct logic for approve and reject

$('.approve_chk').on('click', function () {
    var pswd = prompt("enter password to confirm");
    if (pswd == 'approve') {
        alert('APPROVED');
    } else {
        alert('NOT APPROVED');
        $(".approve_chk").prop('checked', false);
    }
});

$('.reject_chk').on('click', function () {
    var pswd = prompt("enter password to confirm");
    if (pswd == 'reject') {
        alert('REJECTED');
        $(".approve_chk").prop('checked', false);

    } else {
        alert('NOT REJECTED');
        $(".reject_chk").prop('checked', false);
    }
});



Aucun commentaire:

Enregistrer un commentaire