Is there a way to reset the settings of css for an element? i have an input that I want validate and is not possible because I set the border of text input red but I can't come back to the settings of CSS automatically. is there a way for do it? thanks in advance.
EDIT 1
<input id="tm" type="text" onchange="validateStartTime()" name="orario_start" placeholder="Orario inizio">
and validateStartTime()
is
function validateStartTime(){
var t_st=document.getElementsByName("orario_start");
t_st[0].style.borderColor="gray";//HERE I want to set back to the CSS settings automatically
if(t_st[0].value.length==0){
t_st[0].style.borderColor="red";
flag=false;
}
//validation time
var t1=t_st[0].value.split(" ");
if(t1.length!=2){
t_st[0].style.borderColor="red";
flag=false;
}else{
var t1_1=t1[0].split(":");
if(t1_1.length!=2){
t_st[0].style.borderColor="red";
flag=false;
}
}
}