title: Javascript not un-clicking button with link
body: <p>Newish to javascript, but I do't know why the below is not working. I am trying to use javascript to make a link become active after a button has become clicked.</p>
  <p>The user clicks a button that updates the HTML, changes the class and adds a html link. The code works the first time -- the HTML is updated correctly. However if the user decides to un-click the button nothing happens.</p>
  <p>Javascript:</p>
  <pre><code>function agree() {
    let agreement = document.getElementById(&quot;agreement&quot;);
    let agree = document.getElementById(&quot;agree&quot;);
  
    agree.onclick = () =&gt; {
      if (agree.value === true) {
        agreement.innerHTML = `
               &lt;button id=&quot;agree&quot; class=&quot;agree--no&quot; value=&quot;false&quot;&gt;&lt;/button&gt;I agree
                    &lt;div class=&quot;btn--no-schedule&quot;&gt;
                      &lt;a href=&quot;#&quot; &gt; No SCHEDULE  &lt;/a&gt;
                  &lt;/div&gt; `
      } else {
          agreement.innerHTML = `
              &lt;button id=&quot;agree&quot; class=&quot;agree--checked&quot; value=&quot;true&quot;&gt;&lt;i class=&quot;fas fa-lg fa-check-square&quot;&gt;&lt;/i&gt;&lt;/button&gt;I agree
            &lt;div class=&quot;btn--agree-schedule&quot;&gt;
                  &lt;a href=&quot;http://google.com&quot; &gt; yes SCHEDULE  &lt;/a&gt;
         &lt;/div&gt; `
      }
    }
  };
  </code></pre>
  <p>HTML</p>
  <pre><code>&lt;div id=&quot;agreement&quot;&gt;
    &lt;button id=&quot;agree&quot; class=&quot;agree--no&quot; value=&quot;false&quot;&gt;&lt;/button&gt;I agree
      &lt;div class=&quot;btn--no-schedule&quot;&gt;
        &lt;a href=&quot;#&quot; &gt; SCHEDULE  &lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I also tried</p>
  <p><code> &lt;button onclick=“agree();” id=&quot;agree&quot; class=&quot;agree--no&quot; value=&quot;false&quot;&gt;&lt;/button&gt;</code></p>
  <p>but get a type error agree() is not a function.</p>
  <p>Any help would be appreciated</p>