1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-31 00:59:51 +02:00

Read validate-forms.js from assets.

This commit is contained in:
XhmikosR
2020-05-02 18:49:12 +03:00
parent 6824d67beb
commit 358d637d1c
3 changed files with 10 additions and 24 deletions

View File

@@ -1,24 +0,0 @@
// 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)
})
})()