title: Using getElementById to change font color
body: <p>I am trying to make flashcards by setting the text to white, the same color as the background, and then when i press the button, it turns to black, which shows the text. I cannot use <code>getElementsByClass</code>, I can only use <code>getElementById</code>. Each answer needs to have a unique id. It would be ideal to use a radio button instead of a button, like a check box, something that could turn on and off with just a check instead of two buttons. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Book Title&lt;/title&gt;
    &lt;style&gt;
      .answer {
        border-style: solid;
        border-color: #287EC7;
        color: white;
        `
      }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;h3&gt; Flashcards &lt;/h3&gt;
  
  
  
    &lt;p class="question"&gt;
      The first question
    &lt;/p&gt;
  
    &lt;div id="bash_start"&gt;
      &lt;p class="answer"&gt;
        The first answer
      &lt;/p&gt;
    &lt;/div&gt;
  
    &lt;script&gt;
      function myShowtext() {
        document.getElementById("bash_start").style.color = 'white';
      }
  
      function myHidetext() {
        document.getElementById("bash_start").style.color = 'black';
      }
    &lt;/script&gt;
    &lt;br /&gt;
    &lt;div&gt;
      &lt;label&gt;Check Answer:&lt;/label&gt;
      &lt;button onclick="myShowText(bash_start)"&gt;Show Answer&lt;/button&gt;
      &lt;button onclick="myHideText(bash_start)"&gt;Hide Answer&lt;/button&gt;
    &lt;/div&gt;
  
    &lt;p class="question"&gt;
      The second question
    &lt;/p&gt;
  
  
    &lt;div div="bash_pass"&gt;
      &lt;p class="answer"&gt;
        The second answer
      &lt;/p&gt;
    &lt;/div&gt;
  
  
    &lt;script&gt;
      function myHidetext() {
        document.getElementById("bash_pass").style.color = 'white';
      }
  
      function myHidetext() {
        document.getElementById("bash_pass").style.color = 'black';
      }
    &lt;/script&gt;
    &lt;br /&gt;
    &lt;div&gt;
      &lt;label&gt;Check Answer:&lt;/label&gt;
      &lt;button onclick="mySshowTextFunction(bash_pass)"&gt;Show Answer&lt;/button&gt;
      &lt;button onclick="myhideTextFunction(bash_pass)"&gt;Hide Answer&lt;/button&gt;
    &lt;/div&gt;
  
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>