Force Text Input to Lower case using JavaScript

Sometimes its mandatory to get smaller case or uppercase user input from users. For example usually we don’t type email address in capital letters (even if we do, it’s not a crime).

Let’s assume we have a text box as below

Now using jQuery I’m gonna make sure that user will never enter CAPITAL letters in the input text. Following code will do the magic.

$('#contactEmail').keyup(function() {
	var tempEmail = $('#contactEmail').val().toLowerCase();

I hope the code itself is self explanatory.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.

Leave a Reply