0

This is my HTML file:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>First javascript</title>
  <link rel="stylesheet" href="css.css">
  <script src="randomNumber.js"></script>
  <script type="text/javascript">
    getRandomNumber();
  </script>
</head>
<body>
<p id="hello">Hello</p>
</body>
</html>

And this is my Javascript file.

window.onload = function getRandomNumber(){
  var randomNum = Math.floor((Math.random() * 10) + 1);
  console.log(randomNum);
  document.getElementById("hello").innerHTML += randomNum;
}

I cant understand why the code is not working. I am new to programming so if you could give a quick then that would be great.

It's working.

SomeName
  • 25
  • 5
  • 5
    Move your ` – Pointy Feb 17 '16 at 16:21
  • Does your `console.log` fire at all? – sg.cc Feb 17 '16 at 16:22

0 Answers0