Exercise Set 1

Exercise 10 of 15

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

HTML

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

JavaScript

// 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 exercise Next exercise