Double click on the checkbox in IE to indicate the solution to the delay problem

  • 2020-03-30 02:30:04
  • OfStack

 
<span style="font-size:18px;"><input type='checkbox'/></span> 

The above code generates a checkbox in IE, which is checked when clicked, and unchecked when clicked again.

There's nothing wrong with this, but if you try to click fast twice (a little slower than double clicking). This button may not work as you think.

Under IE, if the checkbox is checked at this point, in the course of two quick clicks, the first click causes the checkbox to be deselected. After the second click, the checkbox does not become checked, but remains unchecked.

In a browser such as Chrome, the first click will deselect the checkbox, and after the second click the checkbox will revert to the checked state.

So in IE, when you double-click, the checkbox will be in the opposite state. In non-ie, the checkbox is in the same state after double clicking.

If you want to double click on the checkbox under IE to get a non-ie checkbox, use the following code:
 
<input type='checkbox'/> 
$("input[type='checkbox']").attr('ondblclick', 'this.click()'); 

Related articles: