2
I have the following function: if the input is Nan, it focuses on the field and changes the border
function validaNumero(){
dado = document.getElementById("new_partner");
var formulario = document.getElementById("new_partner");
var dado = formulario.partner_registry_number.value;
if(isNaN(dado)) {
formulario.partner_registry_number.style.focus;
formulario.partner_registry_number.style.border = "2px solid red";
return false;
}
}
So far, so good, but after the first time the function is accessed, the bar always turns red, even typing a valid data. How to solve this?
You can put the HTML?
– Sergio
I believe I will have to call the function again at some point (onchange, Submit) and if it is valid to return the edge to normal.
– BrTkCa
Click on [Edit] and join the HTML so we can answer your question.
– Sergio