Home > Web Front-end > JS Tutorial > body text

Solution to the problem of double-clicking the checkbox response delay under IE_javascript skills

WBOY
Release: 2016-05-16 16:54:17
Original
1387 people have browsed it
Copy code The code is as follows:



The above code will generate a multi-select box under IE. Clicking it will select the check box. Click it again The check will be cancelled.

There seems to be nothing wrong with this, but if you try to click this button twice quickly (a little slower than double-clicking...), the effect may not be as you imagine.

Under IE, if the checkbox is selected at this time, when you click twice quickly, the first click will cause the checkbox to be unchecked, and after the second click, the checkbox will not be selected. will become selected, but will remain unselected.

In browsers such as Chrome, the first click will uncheck the checkbox, and the checkbox will return to the selected state after the second click.

So under IE, after double-clicking, the checkbox will change to the opposite state. Under non-IE, the checkbox is in the same state after double-clicking.

If you want to double-click the checkbox under IE to achieve the effect of non-IE, you need to use the following code:
Copy code The code is as follows:


$("input[type='checkbox']").attr('ondblclick', ' this.click()');
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template