mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-02 16:04:07 +03:00
Lint docs js too and use `strict consistently. (#24160)
This commit is contained in:
@@ -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 %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user