<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var userRegister = document.getElementById('userRegister'); userRegister.addEventListener('submit', function(e) { e.preventDefault(); $('.invalid-feedback').remove(); var name = $("#nameRegister").val(), email = $("#emailRegister").val(), password = $("#passwordRegister").val() if (name == "" || email == "" || password == ""){ $("#nameRegister").parent().after('<div class="invalid-feedback d-block">Please enter name.</div>') $("#emailRegister").parent().after('<div class="invalid-feedback d-block">Please enter email.</div>') $("#passwordRegister").parent().after('<div class="invalid-feedback d-block">Please enter password.</div>') return false; } }) <!-- language: lang-html --> <div class="modal fade" id="modalRegistrarse" role="dialog"> <div class="modal-dialog" > <div class="modal-content"> <button type="button" class="close" data-dismiss="modal">×</button> <div class="modal-body"> <form method="post" class="needs-validation" id="userRegister" novalidate> <h1 class="modalTitulo">Registrarse</h1> <div class="iconoRedes"> <a href="#"><i class="fab fa-google rounded-circle google"></i></a> <a href="#"><i class="fab fa-facebook-f rounded-circle facebook"></i></a> </div> <div class="form-group"> <div class="boxUserRegister"> <label id="labelUserName">User Name</label> <div class="iconsAlerts"> <i class="fa fa-check" id="okUsername"></i> <i class="fa fa-times" id="errorUsername"></i> </div> <input type="text" class="form-control inputRegister" id="nameRegister" required autocomplete="off"> </div> <div class="boxEmailRegister"> <label id="labelUserEmail">Email</label> <div class="iconsAlerts"> <i class="fa fa-check" id="okUserEmail"></i> <i class="fa fa-times" id="errorUserEmail"></i> </div> <input type="email" class="form-control inputRegister" id="emailRegister" required autocomplete="off"> </div> <div class="boxPasswordRegister"> <label id="labelUserPassword">Password</label> <div class="iconsAlerts"> <i class="fa fa-check" id="okUserPassword"></i> <i class="fa fa-times" id="errorUserPassword"></i> </div> <input type="password" class="form-control inputRegister" id="passwordRegister" required autocomplete="off"> </div> </div> <div class="cajaOlvidoContrasena"> <span class="olvidoContrasena">Ya Tiene Una Cuenta ?<a href="#" data-dismiss="modal" data-toggle="modal"><strong> Click Aqui</strong></a></span> </div> <div class="cajaBotonRegistrarse"> <button type="submit" class="btn btn-primary botonRegistrarse">CREAR CUENTA</button> </div> </form> </div> </div> </div> </div> <!-- end snippet --> He estado probando con addEventListener y agregando el prevenDefault, para mis validaciones con javascript, pero cuando le doy click al boton "submit", no se cierra el modal. He visto en consola que si se envia los datos, solo que el modal no se cierra cuando le doy click en "submit", es un registrar usuario.