Reset CSS settings from Javascript -
is there way reset settings of css element? have input want validate , not possible because set border of text input red can't come settings of css automatically. there way it? 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 want set 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; } } }
hi if using jquery can change css directly :
$('#yourelementid').css({ border : 1px solid #ff0000 });
if facing issue of removing red border again onmousedown can remove border.
$('#yourelementid').mousedown(function(){ $(this).css({ border : 1px solid white }); });
Comments
Post a Comment