Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to toggle checkbox state using jQuery in Internet Explorer
    primarykey
    data
    text
    <p>On a form I have, there are two checkboxes, say Master and Slave. Whenever the master is checked, the slave needs to be checked (although slave could be unchecked by individually clicking on it). On the form load - the Master is set to check (default value) which means the slave also needs to be checked. </p> <p>Then, I have some onChange event handler that manually checks and unchecks the slave based on the state of the master. This is where it doesn't work , just in IE. It works fine in other browsers. I have no idea why this is happening. </p> <p>I am using jQuery and some css class that merely toggles between checked image and unchecked image. This is an issue only with the checkbox CSS (visual / graphic). The value is still true for that checkbox. </p> <p>Here is the code</p> <pre><code>dojo.ready(function() { // some code removed for simplicaity sake $("#militaryOfficial").attr("checked", true); $("#waiveTax").attr("checked", true); } $('#militaryOfficial').click('change', toggleTaxWaive); }); function toggleTaxWaive(){ if($("#militaryOfficial").is(':checked')) { if(!$("#waiveTax").is(':checked')) { $("#waiveTax").trigger("click"); } }else { $("#waiveTax").attr('checked', false); } } </code></pre> <p>The HTML is pretty basic. Adding as per requests in the comment </p> <pre><code>&lt;div class="checkBox_Border"&gt; &lt;span class="cds_spanCheck" style="background: url("/images/checkbox_nonSelect.png") no-repeat scroll 0% 0% transparent;"&gt;&lt;/span&gt; &lt;span class="cds_spanCheck" style="background: url("/images/checkbox_Select.png") no- repeat scroll 0% 0% transparent;"&gt;&lt;/span&gt; &lt;input id="waiveTax" class="checkBox_innerWrap" type="checkbox" checked="checked" value="true" name="waiveTax"&gt; &lt;/div&gt; </code></pre> <p>Please advise. Any help much appreciated. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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