#6028 closed bug (worksforme)
JQuery doesn't work with multiple attribute selector on IE 8, FireFox and Chrome
Reported by: | indomitable | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | selector | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
JQuery fails (IE8, FireFox and Chrome, but works fine on IE8 compatibility mode) in following example: ASP.NET and GridView with id gvRadioButtons, I wan't to create a radio buttons column and I use ItemTemplate with radio button, but every radio button is rendered with different name attribute (may be a bug in asp.net no matter this isn't related to problem), that's why I wrote a custom onclick function:
function OnClickRadio(rb) {
$("#gvRadioButtons input[type='radio']").each(function(inx, obj) {
obj.checked = "";
}); rb.checked = 'checked';
}
Ok for now, I always have only one checked radio button The problem is when I want to find checked radio button. First I use (and this works on compatibility mode of IE8) $("#gvRadioButtons input[type='radio'][checked]") but it fails on Firefox/Chrome. I have to write a function that seeks checked radios function HasChecked(radioButtons) {
for (i = 0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
return true;
}
} return false;
}
var checkedRadios = $("#gvRadioButtons input[type='radio']"); if (! HasChecked(checkedRadios)) {
Do Something
}
Finally the problem is that $("input[type='radio'][checked]") doesn't work :(
Attachments (1)
Change History (3)
comment:1 Changed 13 years ago by
Component: | unfilled → selector |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
comment:2 Changed 13 years ago by
I can't use just checked because If I have other kinds of inputs like type="checkbox" it won't work as I want.
Why not just use :checked? That's provided for this exact purpose.