diff --git a/site/assets/js/validate-forms.js b/site/assets/js/validate-forms.js
new file mode 100644
index 0000000000..b79f63f2dc
--- /dev/null
+++ b/site/assets/js/validate-forms.js
@@ -0,0 +1,24 @@
+// Example starter JavaScript for disabling form submissions if there are invalid fields
+(function () {
+ 'use strict'
+
+ // Fetch all the forms we want to apply custom Bootstrap validation styles to
+ var forms = document.querySelectorAll('.needs-validation')
+
+ if (!forms) {
+ return
+ }
+
+ // Loop over them and prevent submission
+ Array.prototype.slice.call(forms)
+ .forEach(function (form) {
+ form.addEventListener('submit', function (event) {
+ if (!form.checkValidity()) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+
+ form.classList.add('was-validated')
+ }, false)
+ })
+})()
diff --git a/site/content/docs/5.0/forms/validation.md b/site/content/docs/5.0/forms/validation.md
index 2b8e1b7aa9..c505163624 100644
--- a/site/content/docs/5.0/forms/validation.md
+++ b/site/content/docs/5.0/forms/validation.md
@@ -96,8 +96,9 @@ Custom feedback styles apply custom colors, borders, focus styles, and backgroun
+{{< /example >}}
-
{{< /example >}}
## Browser defaults