The requirment is that if Reset button is clicked,
- All radio buttons have to be enabled.
- The Daily radio button has to be checked.
These codes works well on IE, Chrome, and Safari. But not work on Firefox!
In firefox,[document.getElementById('day').click(); on JAVASCRIPT 7th line.] won't work well by the following steps.
- Click disable button (to disable all radio buttons.)
- Click reset (to enable all radio buttons and daily radio button is checked.)
Here the Daily radio button is not checked on Firefox.
(There are some other procedures if the radio buttons are changed.So I need to trigger onclick event of the Daily radio button)
HTML
<input type="radio" name="sumType" value="1" id="day" tabindex="1">Daily
<input type="radio" name="sumType" value="2" id="month" tabindex="2" checked>Monthly
<input type="button" value="Disable" onclick="disableRadio()" id="rd1"/>
<input type="button" value="Reset" onclick="init()" id="rd2"/>
Javascript
function disableRadio(){
$("input[type=radio]").attr('disabled','disabled');
}
function init(){
$("input[type=radio]").removeAttr("disabled");
document.getElementById('day').click();
}