Javascript Onkeyup Event Example

Apr 07, 2021 . Admin

Hello Friends, Now let's see example of how to use javascript onkeyup event example. This is a short guide on onkeyup event. Here you will learn how to use javascript onkeyup event. We will use how to use if onkeyup event in javascript. Let's get started with how to onkeyup event in javascript. Here i will give you many example how you can check javascript onkeyup event. Example: 1
In this example i will use id for onclick event
<!DOCTYPE html>
<html>
<head>
   <title>Javascript - How to check if onkeyup event?-MyWebtuts.com</title>
</head>
<body>

<label>Enter your name:</label> <input type="text" value="hello" id="name" onkeyup="myFunction()">

<script>

    function myFunction() {
        var x = document.getElementById("name");
        x.value = x.value.toUpperCase();
    }

</script>

</body>
</html>
Output: 1
    HELLO
Example: 2 In this example i will use attribute for onclick event.
<!DOCTYPE html>
<html>
<head>
   <title>Javascript - How to check if onkeyup event?-MyWebtuts.com</title>
</head>
<body>

    <input type="text" id="demo" onkeyup="keyupFunction()">

    <script>

        function keyupFunction() {
            document.getElementById("demo").style.backgroundColor = "blue";
        }
    </script>

</body>
</html>
Output: 2
    after typing textbox has blue color

It will help you....

#Javascript