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

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

Leave a Reply

Your email address will not be published. Required fields are marked *