title: document is not defined javascript error
body: <p>I have finished a project and it runs perfectly.I keep getting error notifications that 'document' is not defined. I have the same notification every time I address the document. Is there a way I can keep this from being recognized as an error?</p>
  
  <p>JS:</p>
  
  <pre><code>  function check_prime() {
        var input = document.getElementById("enteredNumber").value;
            var number = parseInt(input);
  
  
          if (isNaN(number)) {
         alert("Oops! Please enter a valid number.");
              document.getElementById("enteredNumber").value="";
              document.getElementById("answer").innerHTML =  "";
              document.getElementById("enteredNumber").focus();
  
          }
  
          else if (input.length === 0) {
    alert("Please enter a valid input");
              document.getElementById("enteredNumber").focus();
  
          }
  
         else if (!isNaN(number)) {
                          var divisors = is_perfect(number);
                          if (divisors) {
                              document.getElementById("answer").innerHTML = "Congratulations! " + number + " is a perfect number.";
                        alert("Congratulations! " + number + " is a perfect number. The divisors are: " + divisors.toString() + ".") ;
  
  
                          }
                          else {
                              document.getElementById("answer").innerHTML = "I'm sorry! " + number + " is not a perfect number."
                          }
                      }
                      else {
                          document.getElementById("answer").innerHTML = "Please enter a number.";
                      }
                  }
  
  
  function is_perfect(number) {
  var temp = 0;
  var divisors = [];
  for(var i=1;i&lt;=number/2;i++) {
      if (number%i === 0) {
          divisors.push(i);
          temp += i;
      }
    }  
  
  return temp === number ? divisors : null;
   }
  
  
  
      function clear_textbox(){
        document.getElementById("answer").innerHTML =  "";
        document.getElementById("enteredNumber").value="";
        document.getElementById("enteredNumber").focus();
  
      }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
    &lt;!-- Required meta tags --&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
  
  
      &lt;!-- Bootstrap CSS --&gt;
      &lt;link rel="stylesheet" href="main.css"&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=Oswald:700" rel="stylesheet"&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet"&gt;
  
  
      &lt;/head&gt;
  
  
  
    &lt;body&gt;
  &lt;h2&gt; PERFECTION &lt;/h2&gt;
  &lt;h3&gt; PLEASE ENTER A NUMBER: &lt;/h3&gt;&lt;br&gt;
    &lt;div&gt;
  &lt;input type="text" id="enteredNumber" autofocus value = "" /&gt; &lt;br&gt;&lt;br&gt;
  &lt;input type="submit" value="Check" 
  title="Perfection"
  onclick="check_prime()" /&gt;
  &lt;input type="submit" value="Clear" 
   title="Click here to clear the text box."
  onclick="clear_textbox()" /&gt;
   &lt;br&gt;&lt;br&gt;
  &lt;p id="answer"&gt;&lt;/p&gt;
           &lt;/div&gt;
  
  
  
  &lt;!-- Optional JavaScript --&gt;
  &lt;!-- jQuery first, then Popper.js, then Bootstrap JS --&gt;
  &lt;script src="https://code.jquery.com/jquery-3.2.1.min.js"&gt;&lt;/script&gt;
  &lt;script    src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="app.js"&gt; 
  
    &lt;/script&gt;  
  </code></pre>
  
  <p>
  </p>
  
  <p>I am also getting errors that 'alert' is not defined... I don't know if I missed something.</p>