The following jQuery code actually works fine in MS IE8 but returns ‘undefined’ in MS IE6.
I have also checked other questions in Stack Overflow relating to my query but cannot find any info relating to IE6. I need this code to work in both browsers (IE6 and IE8).
I have the following HTML setup for my radiogroup:
<input type="radio" name="f10" value="abc123"/>
I also have the following code that seems to work fine in IE8 but not in IE6:
function processJob(){
if ($("input[name=f10]:checked").val() != undefined){
isDelgateFlag = "Y";
var delgSelection = $("input[name=f10]:checked").val();
}
else {
isDelgateFlag = "N";
$('#dialogdelegate').dialog('open');
alert("Please make a selection.");
}
}
As mentioned, the $("input[name=f10]:checked").val()
seems to return a value in IE8 but returns ‘undefined’ in IE6.
How can I cater for both browsers?
Quote it f10
if ($("input[name='f10']:checked").val() != undefined){
OR Give a class to the radio button say foo
and
alert($('.foo:checked').val());