[javaScript] Convert text case to lowercase


To convert a string (text) to lowercase one can make use of javaScript toLowercase() function.

Let's see an example:
<html>

<head>
<title>Convert text to lower case!</title>
</head>


<body>

<input type="text"  style="width:300px;padding:6px" id="text" 
placeholder="Enter text to convert to lower case"/> 
<br/><br/>
  <input type="button" value="Convert" onClick="convertToLovercase();"/> 
<br/><br/>
<input type="text"  style="width:300px;padding:6px" id="result" 
placeholder="Result"/> 

<script type="text/javascript">

function convertToLovercase() {

	var data = document.getElementById("text").value;

	var lowerCase = data.toLowerCase();

	document.getElementById("result").value = lowerCase;

}

</script>
</body>

</html>
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap