+ 6
What's wrong with This Code?
Hello World! I'm new to JavaScript & I Can't Understand What's Wrong With This Code. Someone Please Explain It... <!DOCTYPE html> <html> <head> <script> var name = prompt("What Is Your Name?"); document.getElementById("demo").innerHTML = name; </script> </head> <body> <p id="demo"></p> </body> </html>
2 Respostas
+ 4
if you write your code in head the paragraf demo is not known. So works:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="demo"></p>
<script>
var name = prompt("What Is Your Name?");
document.getElementById("demo").innerHTML = name;
</script>
</body>
</html>
+ 6
Yes Bro...
I wanna print it as a paragraph...
#bluesea