Hi there I have a bizarre situation occurring that doesn't make any sense to me.
I have a checkbox which when using internet explorer 7 or 8 (works fine in 9) when you uncheck it sometimes it will instantly re-check itself, you can see it uncheck then recheck itself. In fact it has a pattern, start with it unchecked -> check it -> uncheck it and it will recheck itself. If you uncheck it again then it unchecks fine and you start back at the start of the cycle described above.
The checkb开发者_JAVA百科ox does fire back an ajax call when its checkbox changes. I've checked fiddler and watched the events being fired and there are not multiple events being fired back at the server as a result of this. It just fires back that it is still checked when it does the weird rechecking.
The checkbox is nothing special, with no different classes.
Has anyone encountered something similar?
This is definitely related to the javascript you have attached (but not necessarily to the AJAX part). I have a vague memory that internet explorer used to use a different event order to other browsers - that could be doing it, perhaps? Have you tried adding some debugging information to the javascript events on the checkbox? Sounds like one of them is firing twice in some cases. You don't re-assign your event handler after the ajax call completes?
Try this code, if you like - it will tell you if several click or change events are firing on the same checkbox: http://www.spookandpuff.com/examples/checkboxEventTest.html
If you can put the code somewhere, that'll help a lot, too.
精彩评论