+ 3
What is roung in my js code
22 Answers
+ 3
you should know that when the webpage is loading the script doesnt know anything about hi id because you mention it in the next lines always put your js and jquery at the end of the page
+ 3
hey omar the only thing that you need is just moving your script at the end of the document exactly after the body
+ 1
Paul Grasser i do it in "js page " but nothing change 😕 !!
+ 1
Ya'iko not working 😌💔
+ 1
Ya'iko 👆
+ 1
Remove function because you have kept innerHTML inside function and you are not calling it.
+ 1
MEET MEHTA how ? 🤔
+ 1
Inside script
just write document.get.....
Remove func...{ and }
+ 1
yes
+ 1
+ 1
maybe you're right
+ 1
Hooman Pouyanasab in footer right 😊
+ 1
yourwelcome my friend
0
If you have the src attribute in the script element, it must be empty!
<script src="hello.js">
alert("Hi!")</script>
⬆=Error
<script>
alert("Hi!")</script>
⬆=Ok
And innerHTML not ennirHTML
and hello should be in quotes.
0
I at least spot 3 errors there. Could you post it on Code Playground?
0
Use innerHTML and write hello inside of quotes.
Hope this helps☺️☺️.
0
it's supposed to be
innerHTML
example
=======
document.getElementById("hi").innerHTML = "hello"
Now compare the codes and correct yours
0
what did you type
==============
Type it here directly
0
<!DOCTYPE html>
<html>
<head>
<title>java lern</title>
<script type="text/javascript">
function myFunction() {
document.getElementById("hi").innerHTML = "hello"
}
</script>
</head>
<body>
<div id="hi">
try agine
</div>
</body>
</html>
0
MEET MEHTA like this
<script type="text/javascript">
document.getElementById("hi").innerHTML = "hello"
</script>