title: D3 using classed() to add and remove class with checkbox
body: <p>I am having trouble removing a class that I have added using a checkbox. The checkbox is checked to begin with. When it is unchecked by the user it adds a "hideRect" class with classed('hideRect', true); 
  this works great BUT when I check the box again the class doesn't go away.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>this.$node.append('input')
      .attr('type', 'checkbox')
      .attr('checked', true)
      .attr('value', 'med')
      .on('click', () =&gt; this.updateRectLine());
    }
  
  private updateRectLine() {
  
    //var rect = this.$node.getElementsByClassName('.MEDICATION');
    var cbMed = this.$node.attr("checked");
    if (cbMed !== true){
        this.$node.selectAll(".MEDICATION").classed('hideRect', true);
    }
  
    else if (cbMed == true){
        this.$node.selectAll(".MEDICATION").classed('hideRect', false);
    }
  </code></pre>
  
  <p>}</p>
  
  <p>thanks in advance!</p>