1
Code:
function valida_form (){
var filter_nome = /^([a-zA-Zà-úÀ-Ú0-9]|-|_|\s)+$/ ;
if(!filter_nome.test(document.getElementById("input_nome_cad").value)){
document.getElementById("input_nome_cad").value='';
document.getElementById("input_nome_cad").placeholder = "Nome inválido";
document.getElementById("input_nome_cad").focus();
document.getElementById("input_nome_cad").style.borderColor = "#ff0000";
document.getElementById("input_nome_cad").style.outline = "#ff0000";
return false;}
}
The above code does a check on an "input text", if the field is not valid, the style changes are made.
However, after performing the correct field fill and jumping to the next, the field where the style was changed remains changed, such as returning to the original style after the correct field fill ?
as you said if a little new with Javascript, gives a read on this site: H5F.js, there he explains a lot about the blibioteca implementation in question.
– Tobias Mesquita
@Very interesting tobymosque, but I think it’s easier to learn procedural than classes and libraries, I think I’m a bit of an oldschool conservative, which doesn’t free us from a technology paradox...
– MagicHat