title: JavaScript if Statement after page been loaded
body: <p>I have the following if statement:</p>
  
  <pre><code>echo "&lt;a href='searchPage.php?user_query=$crs_sub1&amp;search=search' id='liSpacing'&gt;&lt;label id='labelSearch'&gt;&lt;input id='checkbox1' type='checkbox' name='checkbox' value='value' checked&gt;&amp;nbsp;$crs_sub1&lt;/label&gt;&lt;/a&gt; &lt;br /&gt;";
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code> &lt;Script&gt;
  
   var crs_category1 =  document.getElementById("checkbox1").checked;
  
  if (crs_category1 === false){
  
  }else{
        document.getElementById("checkbox1").style.visibility = "hidden";
  
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The issue I have is that only checks the input when the page laods. I would want it to be dynamic where after the page as being loaded, once the checkbox is untick, the line goes hidden</p>