Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to do lesson 2 level 1

it doesn't change heading
by

1 Answer

iamabhishek
This is the correct code:

<!doctype html>
<head>
<title>Javascript with HTML</title>
<script>
function doSomething() {
document.getElementById("heading").textContent = "New heading";
}
</script>
</head>
<body>
<h1 id="heading">Some Page Heading</h1>
<button onclick="doSomething()">Click me!</button>
</body>
</html>

Login / Signup to Answer the Question.