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

Level 1 lesson no 2

i dont know how to do it please help me!
by

1 Answer

iamabhishek
Try this:

<!doctype html>
<head>
<title>Javascript with HTML</title>
<script>
/ JS in the head section /
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>

You have to add doSomething() function in the onclick attribute.

Login / Signup to Answer the Question.