Bold/Unbold button
<p>I'm currently working with an online text editor as part of a project, and to say the least, I'm having a small issue with my bold button.</p>

<p>Here is my button in HTML:</p>

<pre><code> &lt;button id="b" onclick="bold()"&gt;Bold&lt;/button&gt;
</code></pre>

<p>And here is my function in JavaScript:</p>

<pre><code>    function bold() {
      var ban = document.getElementById("b");

      if (ban == true) {
        document.getElementById("texto").style.fontWeight = 'bold';
      } else {
        document.getElementById("texto").style.fontWeight = 'normal';
      }
    }
</code></pre>

<p>If I take away everything and just leave it as:</p>

<pre><code>     function bold() {
       document.getElementById("texto").style.fontWeight = 'bold';
     }
</code></pre>

<p>It makes my text bold, but my goal is to be able to unbold the text inside my <code>&lt;textarea&gt;</code> when I click the button a second time.</p>

<p>What am I doing wrong?</p>