56

1

First JavaScript

<div id="btn1" onclick="alert('hello');">Click Me 1</div>

<div id="btn2">Click Me 2</div>
<div id="btn3">Click Me 3</div>
<script>
document.getElementById("btn2").addEventListener("click", function () {
        alert('Hello 2');
    })
    document.getElementById("btn3").addEventListener("click", function () {
        alert('Helllo\nWor\nld'); //Test out line breaks
        /*
        this is a comment
        */
    })
</script>
<script src="script.js"></script>

 

Comments

Please sign in or sign up to comment.