JavaScript Program to Capitalize All Characters While Entering Text

Write a JavaScript program to capitalize all characters while entering text in textbox.



Source Code
<html>
<head>
    <title>Uppercase text while typing</title>
</head>
<body>

<p>Uppercase text while typing</p>

<input type="text" id="myInput" oninput="myFunction()">

<p id="demo"></p>

    <script>
    function myFunction() 
    {
        var x = document.getElementById("myInput").value;
        document.getElementById("demo").innerHTML = "You wrote: " + x.toUpperCase();
    }
    </script>

</body>
</html> 
Output