[javaScript] Convert text case to lowercase


Posted on : Thu, 30th Jul 15 08:28 am (Updated on : Thu, 30th Jul 15 08:28 am) UTC
Author : Code2care
2314 votes

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

Lets see an example :



                    



Advertisements





Source code :

File : file.txt Language : Java
<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>


Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +