Я кодирую скрипт проверки, но когда я запускаю код, ничего не происходит, за исключением того, что все границы текстового поля становятся красными (что должно произойти, но оно по-прежнему остается красным при условии, что есть текст в текстовом поле). Вот мой кодКод проверки javascript wont work
function frontendvalidation(){
var emailaddbox = document.getElementById('emailaddbox').value;
//var emailaddbox = document.forms["signupform"]["emailaddbox"].value;
var username = document.getElementById('username').value;
var password = document.getElementById('passwordbox').value;
var confirmpasswordbox = document.getElementById('confirmpasswordbox').value;
// if our signup fields are empty then the border will be red
if(username === '' || emailaddbox === '' || password=== '' || confirmpasswordbox=== ''){
document.getElementById('username'). style.borderColor = "red";
document.getElementById('emailaddbox').style.borderColor = "red";
document.getElementById('passwordbox').style.borderColor = "red";
document.getElementById('confirmpasswordbox').style.borderColor = "red";
return false;
}
if(username === !'' && username.length => 5) {
document.getElementById('username'). style.borderColor = "green";
return true;
}
if(emailaddbox === !''){
document.getElementById('emailaddbox').style.borderColor = "green";
}
if (password === ! '' && password.length <=5){
document.getElementById('passwordbox').style.borderColor = "green";
}
if (password != confirmpasswordbox){
document.getElementById('confirmpasswordbox').style.borderColor = "red";
} else if (confirmpasswordbox === password){
document.getElementById('confirmpasswordbox').style.borderColor = "green";
return true ;
}
}