How to convert character to lower case when a user leaves an input field with JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>

<head>  
</head>
  
<body>

Enter password: <input type="text" id="input-text-id" onblur="toLowerCase()">


<script>        

function toLowerCase() 
{
    var txt = document.getElementById("input-text-id");
    txt.value = txt.value.toLowerCase();
}

/*
run:
  
When you leave the input text field toLowerCase() triggered
    
*/

</script>


</body>
</html>

 



answered Aug 20, 2015 by avibootz
...