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