Sprawdzanie zaznaczenia checkboxa

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>check input</title>
  <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
</head>
<body>
<label for="id_checbox">
  <input type="checkbox" id="id_checbox">Zaznacz
</label>
  <script>
    $('#id_checbox').change(function() {
      if ($(this).is(':checked')) {
        console.log('Checked');
      } else {
        console.log('Unchecked');
      }
    });
  </script>
</body>
</html>
Komentarze wyłączone