Note that there are some explanatory texts on larger screens.

plurals
  1. POmaking the checkbox to display div
    text
    copied!<p>here am trying to display divs ClinicFieldSet and HospitalFieldset by selecting the given text boxes. If both are selected, both ClinicFieldset and HospitalFieldset should display and if one of the check box is selected it should show which div is selected.</p> <p>The problem with my script is, when one of the checkboxes are clicked, both checkboxes are getting selected and it is not posible to uncheck them also. So please suggest me an idea to fix this problem :(</p> <p>I used Javascript onClick in both checkboxes to apply on both of them.</p> <pre><code>&lt;script type="text/javascript&gt; var clinic = document.getElementById('clinic'); var visit = document.getElementById('visit'); if((clinic.checked = true) &amp;&amp; (visit.checked = true) ) { document.getElementById('ClinicFieldSet').style.display='block'; document.getElementById('HospitalFieldSet').style.display='block'; } else if((clinic.checked = true) &amp;&amp; (visit.checked = false)) { document.getElementById('ClinicFieldSet').style.display='block'; document.getElementById('HospitalFieldSet').style.display='none'; } else if((clinic.checked = false) &amp;&amp; (visit.checked = true)) { document.getElementById('ClinicFieldSet').style.display='none'; document.getElementById('HospitalFieldSet').style.display='block'; } else { document.getElementById('ClinicFieldSet').style.display='none'; document.getElementById('HospitalFieldSet').style.display='none'; } </code></pre> <p></p> <p>HTML</p> <pre><code>&lt;input type="checkbox" name="type" id="clinic" onClick="dispp();" &gt;Clinic Practice &lt;input type="checkbox" name="type" id="visit" onClick="dispp();" &gt;Visiting Hospital </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload