javascript - Removing border when the form field is in focus -
i making border appear form field during form validation. appending error class name div class name achieve it:
document.getelementbyid("name").classname = document.getelementbyid("name").classname + " error"; document.getelementbyid("email").classname = document.getelementbyid("email").classname + " error"; &.error { border:3px solid #cc4337; transition:#cc4337 .2s linear 0; -webkit-transition:#cc4337 .2s linear 0; -moz-transition:#cc4337 .2s linear 0; }
now, when click onto form field retype want border disappear. there way can remove error (or style border:none) class name tracking field focused?
thanks
try
&.error:focus{ border: none; border-color: transparent; }
or try
document.getelementbyid(id).style.property=new style
eg.
<script> document.getelementbyid("error").style.border-color = "transparent"; </script>
and possibly implement using like
<input type="text" id="fname" onfocus="myfunction(this.id)">
Comments
Post a Comment