Get started with zxcvbn CDN

MIT licensed

Zxcvbn is a library that evaluates password strength.

Tags:
  • passwords
  • forms
  • security

Stable version

Copied!

How to start using zxcvbn CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with zxcvbn CDN - cdnhub.io</title>
  <link rel="stylesheet" href="styles.css">
  <script src="https://cdn.jsdelivr.net/npm/zxcvbn@4.4.2/zxcvbn.js"></script>
</head>
<body>
  <div id="password-strength-meter">
    <label for="password">Enter your password:</label>
    <input type="password" id="password" name="password">
    <button id="check-password">Check Password</button>
    <div id="strength-meter"></div>
  </div>
  <script>
    const passwordInput = document.getElementById('password');
    const checkPasswordButton = document.getElementById('check-password');
    const strengthMeter = document.getElementById('strength-meter');

    checkPasswordButton.addEventListener('click', () => {
      const password = passwordInput.value;
      const passwordStrength = zxcvbn(password).passwordStrength;
      strengthMeter.innerHTML = `Password strength: ${passwordStrength}`;
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions