title: Validate blank spaces in Javascript
body: <p>I have some blank spaces in a paragraph that requires the correct word to be entered when written into it. I have a function checking if the words are correct and another that will change the font of the incorrect word entered to be red.</p>
  
  <p>Does anyone know where I went wrong in this code? The isCorrect() function works when I am not calling the font() function, but I don't know what would be wrong with the font() function.</p>
  
  <p>Thanks</p>
  
  <pre><code>function isCorrect(){
      var word1 = document.getElementById("word1").innerHTML;
      var word2 = document.getElementById("word2").innerHTML;
      var word3 = document.getElementById("word3").innerHTML;
      var word4 = document.getElementById("word4").innerHTML;
      var word5 = document.getElementById("word5").innerHTML;
      var word6 = document.getElementById("word6").innerHTML;
      var word7 = document.getElementById("word7").innerHTML;
  
      font(word1, word2, word3, word4, word5, word6, word7);
  
  
      if (word1 == "digg" &amp;&amp; word2 == "face" &amp;&amp; word3 == "book" &amp;&amp; word4 == "tumbled" &amp;&amp; word5 == "linked" &amp;&amp; word6 == "interest" &amp;&amp; word7 == "follow")
      {
          alert("Correct");
      }
      else
      {
          alert("Not Correct");
      }
  }
  
  //if wrong word is entered, it should turn red
  function font(word1, word2, word3, word4, word5, word6, word7)
  {
      if (word1 != "digg")
      {
          word1.style.color = "red";
      }
  
      else
      {
          word1.style.color = "white";
      }
  
      if (word2 != "face")
      {
          word2.style.color = "red";
      }
      else
      {
          word2.style.color = "white";
      }
  
      if (word3 != "book")
      {
          word3.style.color = "red";
      }
      else
      {
          word3.style.color = "white";
      }
  
  
      if (word4 != "tumbled")
      {
          word4.style.color = "red";
      }
      else
      {
          word4.style.color = "white";
      }
  
      if (word5 != "linked")
      {
          word5.style.color = "red";
      }
      else
      {
          word5.style.color = "white";
      }
  
      if (word6 != "interest")
      {
          word6.style.color = "red";
      }
      else
      {
          word6.style.color = "white";
      }
  
      if (word7 != "follow")
      {
          word7.style.color = "red";
      }
      else
      {
          word7.style.color = "white";
      }
  
  }
  </code></pre>