JavaScript can change HTML content





What Can JavaScript Do?


Answer: JavaScript can change HTML content.

Explaination:

<!DOCTYPE html>
<html>
<body>

<h1>What Can JavaScript Do?</h1>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button"
onclick="document.getElementById('demo').innerHTML = 'Hello JavaScript!'">
Click Me!</button>

</body>
</html>


Output:
What Can JavaScript Do?

JavaScript can change HTML content. //paragraph content before click

Click Me!   //this is button


What Can JavaScript Do?

Hello JavaScript!  //paragraph content changed

Click Me! //this is button



No comments:

Post a Comment

We are here to listen you, Comment your valueable opinion...!!!