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);
})();