Home »
JavaScript Examples
JavaScript - Display Input Text into Uppercase
In this code snippet we will learn how to convert input text into uppercase using JavaScript function.
Convert Input Text into Uppercase Characters
JavaScript Function:
<script type="text/javascript">
function convertCase(text){
var strUCase= text.toUpperCase();
document.getElementById("dispText").innerHTML = strUCase;
}
</script>
JavaScript and HTML Code to Display Input Text into Uppercase
<!--JavaScript-Display Input Text into Uppercase Characters.-->
<html>
<head>
<title>JavaScript-Display Input Text into Uppercase Characters.</title>
<script type="text/javascript">
function convertCase(text){
var strUCase= text.toUpperCase();
document.getElementById("dispText").innerHTML = strUCase;
}
</script>
</head>
<body style="text-align: center">
<h1>JavaScript-Display Input Text into Uppercase Characters.</h1>
<input type="text" id="inputText"/><br><br>
<input type="button" value="Display in Uppercase" onClick='convertCase(inputText.value)'/>
<!--Uppercase text will display here-->
<div id="dispText" style="text-size: 200%"></div>
</body>
</html>
Result
JavaScript Examples »