Exercise Set 1

Exercise 1 of 6

Make a variable for the button. 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 topic Next exercise