Get started with bootstrap-validator CDN

http://bootstrapvalidator.com/license/ licensed

Free, open-source library: Bootstrap Validator adds form validation to Bootstrap forms.

Tags:
  • twitter
  • bootstrap
  • validator

Stable version

Copied!

How to start using bootstrap-validator CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with bootstrap-validator CDN - cdnhub.io</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.cdnhub.io/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.cdnhub.io/bootstrap-validator/0.5.3/js/bootstrapValidator.min.js"></script>
</head>
<body>
    <div class="container mt-5">
        <form id="myForm" method="post" data-toggle="validator" role="form">
            <div class="form-group">
                <label for="name">Name</label>
                <input type="text" class="form-control" id="name" name="name" required data-error="Name is required" data-validation-message="Please enter your name">
                <div class="invalid-feedback"></div>
            </div>
            <div class="form-group">
                <label for="email">Email address</label>
                <input type="email" class="form-control" id="email" name="email" required data-error="Invalid email format" data-validation-message="Please enter a valid email address">
                <div class="invalid-feedback"></div>
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>
        </form>
    </div>

    <script>
        $('#myForm').on('submit', function(e) {
            e.preventDefault();
            $('#myForm').data('bootstrapValidator').validate();
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions