Exercise Set 1

Exercise 1 of 6

Make a variable for the button. If you're having trouble, rewatch the getting element video.


<button id="sayHelloButton">Say hello</button>
<p id="helloParagraph"></p>


// your code will appear here
var helloParagraph = document.getElementById("helloParagraph");

sayHelloButton.addEventListener("click", sayHello);

function sayHello() {
    helloParagraph.innerHTML = "Hello";

You must be signed in to type your code.

Last topic Next exercise