[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
100+ votes

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

Lets see an example :



Source code :

File : file.txt Language : Java

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


<input type="text"  style="width:300px;padding:6px" id="text" placeholder="Enter text to convert to lower case"/> 
  <input type="button" value="Convert" onClick="convertToLovercase();"/> 
<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;




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 +