Home >>Javascript Programs >Display Input Text into Lowercase using JavaScript

Display Input Text into Lowercase using JavaScript

Display Input Text into Lowercase using JavaScript

In this code we will learn how to display input into Lowercase by using JavaScript. To converting the string to Lowercase we are using toLowercase() method. toLowercase() method helps you to converts a string to lowercase letters. It does not affect any of the characters, digits and the alphabets which are already in the lower. JavaScript makes it easy to convert a string into Loweracase.

Let's take an example:

<!DOCTYPE html> 
<html> 
<head> 
<title> Display Input Text into Lowercase using JavaScript</title> 
<script type="text/javascript">
			function convertlowerCase(text){
				var strLCase= text.toLowerCase();
				document.getElementById("dispText").innerHTML = strLCase;
			}
		</script>
</head> 
<body> 
 <input type="text" id="inputText"/><br><br>
    <input type="button" value="Display in Lowercase" onClick='convertlowerCase(inputText.value)'/>
    <div id="dispText" style="text-size: 200%"></div>									 						 
</body> 
</html>
Output: