Checkboxes are being checked before click handler is even called

前端 未结 2 1380
名媛妹妹
名媛妹妹 2021-01-15 13:47

I have the following snippets: http://jsfiddle.net/L7rne/5/ and http://jsfiddle.net/L7rne/6/

It turns out that if you pause execution of the script in the click even

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 14:31

    not sure I'm understanding the problem. why wouldn't it be the right behaviour?

    seriously, let's say you write some code that shows/hides a div based on whether a checkbox is ticked or not.

    so, you write an onclick. if the checkbox is unticked, and then you click it, what do you think should be done to the div? obviously, you would expect the event to find the checkbox to be checked.

提交回复
热议问题