Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>This example uses the addEventListener() method to attach a "change" event to an input element.</p>

Enter your name: <input type="text" id="fname">

<p>When you leave the input field, a function is triggered which transforms the input text to upper case.</p>

<script>
document.getElementById("fname").addEventListener("change", myFunction);

function myFunction() {
    var x = document.getElementById("fname");
    x.value = x.value.toUpperCase();
}
</script>

</body>
</html>



Result:
Try it Yourself - © w3schools.com
Privacy Policy