Encountering an issue with radio buttons in combination with bootstrap and javascript, where querying the selected radio button results in reading the previous selection instead of the current one.
A Minimal Working Example (MWE) has been created to demonstrate this problem. To see it in action, turn on Console:
https://jsbin.com/pasujeqeli/edit?html,output
Upon clicking 'Zero', the console logs True. However, clicking 'Zero' again logs False, indicating that the logging is lagging behind the actual state of the radio buttons.
This bug can be replicated even without using bootstrap.css by clicking on the label associated with the radio button instead of the button itself.
It appears that clicking the label triggers the onclick
method before updating the radio button, while clicking the button directly triggers the method after updating the button.
The question at hand is: How can the js or html be adjusted to reliably query the current state of the radio buttons?