Leave fields blank with Jquery

1

I have a fullcalendar; if I click on a day a registration form is opened, and I have a Jquey with some validations, I click on the add button and the fields that have NOT entered data in red are left in red (that's fine).

Fullcalendar image:

Image of the fields:

What happens is that when I close the modal and when I open another day all the fields are red and they should be in normal white, how would you solve that problem?

Jquery Code.

    (function ValidacionesAgregar() {
    'use strict';
    window.addEventListener('load', function() {
        var forms = document.getElementsByClassName('needs-validation');
        var validation = Array.prototype.filter.call(forms, function(form) {
            document.getElementById("btnAgregar").addEventListener("click", function(event) {
                if (form.checkValidity() === false) {
                event.preventDefault();
                event.stopPropagation();
                }
                form.classList.add('was-validated');
            }, false);
        });
    }, false);
})();
    
asked by Jairo Arturo Cifuentes 27.09.2018 в 23:21
source

0 answers