samedi 20 janvier 2018

How do I uncheck the checkbox after modal dialog button is clicked?

Here's my problem:

Fiddle here: https://www.bootply.com/jMryRDRZNT

I need to display a warning message when a user clicks a checkbox. A modal dialog is then displayed where user can click 'I understand' and 'Cancel' When 'Cancel' button is clicked I want to uncheck the checkbox.

I try to do it this way:

$('#btnModalCancel').click(function() {
    $('chkImm').attr('checked', false);
});

tried also 'prop' instead of attr - still not working. It appears that after the dialog is displayed something is preventing the checkbox from changing. I placed console.log('test') inside the function - it is called, but the checkbox is not getting unchecked... See the fiddle in the link above.




Aucun commentaire:

Enregistrer un commentaire