Get started with jqBootstrapValidation CDN
MIT licensed
JqBootstrapValidation is a lightweight library for validating forms using Bootstrap styles.
Tags:- jquery
- validation
- plugin
- form
- bootstrap
Stable version
Copied!
How to start using jqBootstrapValidation CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with jqBootstrapValidation CDN - cdnhub.io</title>
<link rel="stylesheet" href="https://stack.bootstrapcdn.com/bootstrap/5.3.2/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.cdnhub.io/jqBootstrapValidation/1.3.7/jqBootstrapValidation.min.js"></script>
</head>
<body>
<div class="container mt-5">
<form id="myForm" method="post" data-toggle="validator" role="form">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
<div class="invalid-feedback">
Name is required.
</div>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email address</label>
<input type="email" class="form-control" id="email" name="email" required>
<div class="invalid-feedback">
Please enter a valid email address.
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<script>
$('#myForm').on('submit', function(e) {
e.preventDefault();
if ($('#myForm').validate().isValid()) {
// Form is valid, submit it using AJAX or any other method
console.log('Form is valid, submitting...');
}
});
</script>
</body>
</html>
Copied!
Copied!