What is roung in my js code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
16th Jul 2018, 12:13 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
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
16th Jul 2018, 5:08 PM
Hooman Pouyanasab
Hooman Pouyanasab - avatar
+ 3
hey omar the only thing that you need is just moving your script at the end of the document exactly after the body
16th Jul 2018, 5:05 PM
Hooman Pouyanasab
Hooman Pouyanasab - avatar
+ 1
Paul Grasser i do it in "js page " but nothing change 😕 !!
16th Jul 2018, 12:20 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
Ya'iko not working 😌💔
16th Jul 2018, 12:40 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
Ya'iko 👆
16th Jul 2018, 1:13 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
Remove function because you have kept innerHTML inside function and you are not calling it.
16th Jul 2018, 1:18 PM
Meet Mehta
Meet Mehta - avatar
+ 1
MEET MEHTA how ? 🤔
16th Jul 2018, 1:20 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
Inside script just write document.get..... Remove func...{ and }
16th Jul 2018, 1:21 PM
Meet Mehta
Meet Mehta - avatar
+ 1
yes
16th Jul 2018, 1:33 PM
Meet Mehta
Meet Mehta - avatar
16th Jul 2018, 1:42 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
maybe you're right
16th Jul 2018, 1:45 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
Hooman Pouyanasab in footer right 😊
16th Jul 2018, 5:10 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 1
yourwelcome my friend
16th Jul 2018, 5:21 PM
Hooman Pouyanasab
Hooman Pouyanasab - avatar
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.
16th Jul 2018, 12:18 PM
Paul Grasser
Paul Grasser - avatar
0
I at least spot 3 errors there. Could you post it on Code Playground?
16th Jul 2018, 12:19 PM
Calviղ
Calviղ - avatar
0
Use innerHTML and write hello inside of quotes. Hope this helps☺️☺️.
16th Jul 2018, 12:19 PM
Meet Mehta
Meet Mehta - avatar
0
it's supposed to be innerHTML example ======= document.getElementById("hi").innerHTML = "hello" Now compare the codes and correct yours
16th Jul 2018, 12:20 PM
Dlite
Dlite - avatar
0
what did you type ============== Type it here directly
16th Jul 2018, 12:41 PM
Dlite
Dlite - avatar
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>
16th Jul 2018, 1:01 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
0
MEET MEHTA like this <script type="text/javascript"> document.getElementById("hi").innerHTML = "hello" </script>
16th Jul 2018, 1:31 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar