Note that there are some explanatory texts on larger screens.

plurals
  1. PODifference of behaviour when clicking an "indeterminate" checkbox in HTML
    primarykey
    data
    text
    <p><strong>UPDATE:</strong> This is not a duplicate of <a href="https://stackoverflow.com/questions/10099158/how-to-deal-with-browser-differences-with-indeterminate-checkbox">this question</a>. The linked Q has no proper answers, without even letting me the time to find one and post it here. So if you are interested in the answer, check the one I posted in the "duplicate" question <a href="https://stackoverflow.com/a/19447939/1010492">https://stackoverflow.com/a/19447939/1010492</a>.</p> <hr /> <p>I am trying to display a checkbox with the "indeterminate" state, which becomes checked when you click it.</p> <p>To do so, I am initialising the checkbox in JavaScript this way:</p> <pre><code>checkbox.checked = false; checkbox.indeterminate = true; </code></pre> <p>On Chrome and Firefox, the checkbox will become checked after clicking it (this is the desired behaviour). On Internet Explorer, it will become un-checked.</p> <p>However, if I initialise the checkbox to <code>checked = true</code>, the exact opposite behaviour can be observed.</p> <p>I am struggling to find a solution to initialise the checkbox to the right value so it behaves as desired. I have not been able to find a satisfying solution on stackoverflow. <strong>I do not want to use an image solution (I want the native browser's look and behaviour), and I am not too keen neither on messing with mousedown and click events...</strong></p> <p>What's the best approach you can suggest? I'm not too keen on using user agent detection since IE11 is coming soon, but is there really a choice?</p>
    singulars
    1. This table or related slice is empty.
    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