I'm trying to programatically select a radio button using jQuery 1.4.2. It works in IE 8 and Chrome 12 but doesn't seem to work in Firefox 5.
The HTML for the radio button is:
<input type='radio' name='selected-row'>
The code I'm using is below, where radioButton is a jQuery object.
onCellSelect: function (rowid, iCol, cellcontent, e) {
var cell = $(e.srcElement);
var radioButton = cell.closest("tr").find("input[type='radio']");
radioButton.click();
}
I've also tried using the below based on stuff I found googling and that works in both IE and Chrome, but not Firefox.
radioButton.attr("checked", "true");
radioButton.button("refresh");
How does one get this to work in Firefox?
Like takeek's above the following works in Firefox 5
<input id="myRadioButton" type="radio" name="selected-row">
and using works
$('#myRadioButton').attr('checked', true);
Check your radioButton variable is what you expect it to be. How are you selecting your radio button?
Also prop() was only introduced to jQuery in 1.6 so attr() is fine here.