Question 04 of 05

Event Handling

Create a page with multiple event listeners for mouse and keyboard events.

C++
<!DOCTYPE html>
<html>
<body>
    <button id="btn">Hover or Click</button>
    <p id="output"></p>
    <script>
        let btn = document.getElementById("btn");
        btn.addEventListener("click", function() {
            document.getElementById("output").innerHTML = "Button clicked!";
        });
        btn.addEventListener("mouseover", function() {
            document.getElementById("output").innerHTML = "Mouse over button!";
        });
    </script>
</body>
</html>
Question 4 of 5