samedi 9 janvier 2016

How to stop a function after checkbox has been unchecked?

I am calling a JQuery function when the checkbox is checked but when I uncheck it, the function keeps on being triggered.

Codes

$(document).ready(function () {
    $('#check').change(function () {
        if ($(this).is(':checked')) {
            drawLine();
        }
        else if (!$(this).is(':checked'))
        {
          stop();
        }
    });
});

Any idea how I can stop the function?




Aucun commentaire:

Enregistrer un commentaire