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>

HTML Source Code with JavaScript:

<!--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

display input text in uppercase javascript

JavaScript Examples »



Related Examples



All JavaScript Examples

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.