Encountering an issue in various versions of Internet Explorer (9,10,11): I have a group of radio buttons that need to be disabled but still submitted with the form. To achieve this, I devised a method using the following functions:
var doNothing = function(event){
event.preventDefault();
event.stopPropagation();
}
var disableRadio = function($elem){
$elem.bind('click.radiostate', doNothing);
$elem.addClass('disabledRadioClass');
}
Instead of adding the disabled
attribute and styling the disabled buttons with CSS by setting opacity:.5;
for the visual effect of being disabled. However, there is a problem - when selecting the 'disabled' radio button in IE, the selected radio button becomes unchecked, despite having its checked
attribute still set to checked! Here is a visual representation of the issue:
Before clicking on the 'disabled' radio (Radio 2):
https://i.sstatic.net/XTAgX.png
And after:
https://i.sstatic.net/w2l6g.png
No radio button remains selected. However, upon submitting the form and refreshing the page, Radio 3 is selected again.
Desired Outcome: When clicking on the custom-made disabled button, the currently selected button (e.g. Radio 3) should remain selected, similar to how it functions in Chrome, ensuring at least one radio button stays checked.