title: Uncaught TypeError: Cannot read properties of null (reading 'checked')
body: <p>I try to get the value of Checkbox through the following function:</p>
  <pre><code>function sickness_selection() {
      var element = event.target.id;
      // console.log( event.target.checked);
      element = document.getElementById(element);
      if (element.checked === true) {
          element.parentElement.classList.add(&quot;asanism-selected-radio&quot;);
      } else {
          element.parentElement.classList.remove(&quot;asanism-selected-radio&quot;);
      }
  }
  </code></pre>
  <p>the function works but receives the following error in the console:</p>
  <pre><code>Uncaught TypeError: Cannot read properties of null (reading 'checked')
      at sickness_selection (js_cEGLc76e0OdunEJf9-WqG_aDsYoNtkkBvpRxiXeaSmg.js:1701:17)
      at HTMLDivElement.onclick (create:1:1)
  </code></pre>
  <p>because the value does not render in the HTML file while changing the input:</p>
  <pre><code>&lt;div class=&quot;js-form-item js-form-type-checkbox checkbox form-check js-form-item-sickness7 form-item-sickness7&quot;&gt;
              &lt;label class=&quot;form-check-label&quot;&gt;
              &lt;input data-drupal-selector=&quot;edit-sickness7&quot; type=&quot;checkbox&quot; id=&quot;edit-sickness7--iViLtzwqW-A&quot; name=&quot;sickness7&quot; value=&quot;1&quot; class=&quot;form-checkbox form-check-input&quot; required=&quot;&quot;&gt;
                &amp;nbsp;&lt;label for=&quot;edit-sickness7--iViLtzwqW-A&quot; class=&quot;option&quot;&gt;somthing&lt;/label&gt;
            &lt;/label&gt;
                &lt;/div&gt;
  </code></pre>
  <p>is there any solutions for error?</p>