write "Hello" inside an HTML element with id="demo": - Javascript Language Basics

Javascript examples for Language Basics:HTML

Description

write "Hello" inside an HTML element with id="demo":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<h1>My Web Page</h1>

<p id="demo">My first paragraph.</p>

<script>
document.getElementById("demo").innerHTML = "Hello";
</script>/*from  ww  w .  jav  a2  s .  c  o  m*/

</body>
</html>

Related Tutorials