I need to change the X glyphicon,glyphicon-remove from https://getbootstrap.com/docs/3.3/components/ to a check glyphicon,glyphicon-ok if the input email is valid. So my question is how to know if an email inputed and checked by keyup is valued.
var emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$/i
document.getElementById("Email").addEventListener("keyup",
function() {
var email = document.getElementById("Email").value;
if (emailRegex.test(email)) {
document.getElementById("EmailValidate").classList.remove('glyphicon,glyphicon-remove');
document.getElementById("EmailValidate").classList.add('glyphicon,glyphicon-ok');
}
});