How to solve the latency problem by double-clicking checkbox under IE _ javascript tips-js tutorial

Source: Internet
Author: User
This article mainly introduces how to solve the latency problem by double-clicking checkbox under IE. For more information, see The Code is as follows:




The above code will generate a multi-choice box under IE. Clicking it will check the box and clicking it again will cancel the check.

It seems nothing wrong, but if you try to click twice quickly (a little slower than double-click ..) This button may not work as you think.

In IE, if the checkbox is selected at this time, when you click twice quickly, the first click will make the checkbox unselected, after the second click, the checkbox will not change to selected, but will continue to be deselected.

In Chrome and other browsers, the first click will cancel the checkbox selection. After the second click, the checkbox will be restored to the selected status.

So in IE, after double-clicking, the checkbox will change to the opposite state. In a non-IE environment, the checkbox is in the same status after double-clicking.

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

The Code is as follows:



$ ("Input [type = 'checkbox']"). attr ('ondblclick', 'this. click ()');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.