Research on check status and display state of checkbox

Source: Internet
Author: User

This afternoon to do a primary school website, there is a custom choice to remember the password

The idea is to hide the default checkbox, customize an element, and click Change class to simulate, but when debugging, it is found that when the default checkbox is selected, the Ckecked property may be false, I comment out the event, If no event is found, click the Custom Radio box and the default Radio box can be selected. That is, there is no need to add a click event within the label tag to help change the checkbox's properties, but the strange scene has happened,

When I look at the checkbox's selection, I find that the checkbox's Checked property is exactly the opposite of what I wanted:

Is it a bug?

After more than 10 minutes of research, and finally found the answer, because of the print properties, the console is still in the element's click event, I guess, the event flow may be waiting for me to bind the Cilck event after the execution, and then to modify the properties of checked. Why do you say that? Look at the comments above should be able to find the answer, I put the console delayed hundreds of milliseconds, the change checked properties of the event has been completed, the printed result is also normal.

Research on check status and display state of checkbox

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.