Get started with jReject CDN

(MIT OR GPL-2.0) licensed

Java library for efficient exception handling and chaining: jReject.

Tags:
  • browser
  • reject
  • popup

Stable version

Copied!

How to start using jReject CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with jReject CDN - cdnhub.io</title>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.cdnhub.io/jReject/1.1.5/js/jquery.reject.min.js"></script>
  <script>
    $(document).ready(function() {
      $('#myForm').jReject({
        rules: {
          'input[name="username"]': {
            required: true,
            minlength: 3
          },
          'input[name="email"]': {
            required: true,
            email: true
          },
          'input[name="password"]': {
            required: true,
            minlength: 6
          }
        },
        messages: {
          'input[name="username"]': {
            required: 'Please enter a username.',
            minlength: 'Your username must be at least 3 characters long.'
          },
          'input[name="email"]': {
            required: 'Please enter an email address.',
            email: 'Please enter a valid email address.'
          },
          'input[name="password"]': {
            required: 'Please enter a password.',
            minlength: 'Your password must be at least 6 characters long.'
          }
        }
      });

      $('#myForm').on('submit', function(event) {
        event.preventDefault();
        $(this).jReject();
      });
    });
  </script>
</head>
<body>
  <form id="myForm">
    <label for="username">Username:</label>
    <input type="text" name="username" id="username">
    <span class="error"></span>

    <label for="email">Email:</label>
    <input type="email" name="email" id="email">
    <span class="error"></span>

    <label for="password">Password:</label>
    <input type="password" name="password" id="password">
    <span class="error"></span>

    <button type="submit">Submit</button>
  </form>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions