Convert lowercase to uppercase in JavaScript

This tutorial will show you how to convert from lowercase to uppercase using JavaScript onkeyup event. There is an input box where you will type and onkeyup JavaScript event will call a custom function which will convert the lowercase letter to uppercase letter. onkeyup means as you type the function will be called and the letter will be converted instantly to uppercase.

Below is the whole source code

<!doctype html>
		<script type="text/javascript">
			function convertToUppercase() {
				document.getElementById('output').innerHTML = document.getElementById('input').value.toUpperCase()
		<div>Enter lowercase letters for conversion to uppercase</div>
			<input type="text" id="input" onkeyup="convertToUppercase()"/>
		<p id="output"/>

In the above code, we have called a function convertToUppercase which will get the input letter as you type and write to a paragraph instantly.

If you type uppercase letter there will be no change and uppercase letter will be displayed.

Thanks for your reading.

Leave a Reply

Your email address will not be published.