@clifford Используйте метод is(':checked') в jQuery чтобы проверить активен или нет чекбокс, посмотрите ниже пример кода:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<html> <head> <script src="https://code.jquery.com/jquery-2.2.4.js"></script> </head> <body> <div> <label for="terms">Принять условия: </label> <input type="checkbox" id="terms"/> </div> </body> <script> // Слушать изменение (on change) событие $("body").on("change", "#terms", function () { // Проверить активен или нет чекбокс let isChecked = $("#terms").is(':checked'); // True/False console.log(isChecked) }) </script> </html> |