diff options
Diffstat (limited to 'docs/4.0/components')
| -rw-r--r-- | docs/4.0/components/forms.md | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/docs/4.0/components/forms.md b/docs/4.0/components/forms.md index 76d14dde9..ed4d95b70 100644 --- a/docs/4.0/components/forms.md +++ b/docs/4.0/components/forms.md @@ -739,18 +739,19 @@ When attempting to submit, you'll see the `:invalid` and `:valid` styles applied <script> // Example starter JavaScript for disabling form submissions if there are invalid fields (function() { - "use strict"; - window.addEventListener("load", function() { - var form = document.getElementById("needs-validation"); - form.addEventListener("submit", function(event) { - if (form.checkValidity() == false) { + 'use strict'; + + window.addEventListener('load', function() { + var form = document.getElementById('needs-validation'); + form.addEventListener('submit', function(event) { + if (form.checkValidity() === false) { event.preventDefault(); event.stopPropagation(); } - form.classList.add("was-validated"); + form.classList.add('was-validated'); }, false); }, false); -}()); +})(); </script> {% endexample %} |
