score:12

Accepted answer

You need to update the below function like this

private updateRectLine() { 
  var cbMed = this.$node.select("input[type='checkbox']").prop("checked");
  if (!cbMed)
    this.$node.selectAll(".MEDICATION").classed('hideRect', true);
  else
    this.$node.selectAll(".MEDICATION").classed('hideRect', false);
}

.attr() function only returns the value the checkbox was initialized to, to check for a checkbox's check state, you want to use property checked present on check box elements


Related Query