How to convert string from upper to lowercase using javascript

Last updated on March 22nd, 2022 at 05:07 pm

Click to rate this tutorial!
[Total: 24 Average: 4.1]

This tutorial will show you how to accept only lower case letters while user type something on the input field provided.

Type some letters in caps [uppercase]<input type="text" name="caps" size="40" value="" onchange="javascript:this.value=this.value.toLowerCase();">
Click on this field <input type="text" name="other" size="40" value="">

Below script will accept all upper case and convert it to lower case .

Type some letters in [lowercase]<input type="text" name="caps" size=40 value="" onChange="javascript:this.value=this.value.toUpperCase();"/>
Click on this field <input type="text" name="other" size=40 value=""/>

We are doing this with just single line of code that is this.value.toUpperCase() and this.value.toLowerCase()

If you are interested in taking a look at how to change only the first letter of a word to uppercase check this tutorial.

Demo

Click to rate this tutorial!
[Total: 24 Average: 4.1]

Leave a Reply

Your email address will not be published.