Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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)

index.html (1.4 KB) - added by indomitable 10 years ago.
Here it is a simple example

Download all attachments as: .zip

Change History (3)

comment:1 Changed 10 years ago by john

Component: unfilledselector
Resolution: worksforme
Status: newclosed

Why not just use :checked? That's provided for this exact purpose.

Changed 10 years ago by indomitable

Attachment: index.html added

Here it is a simple example

comment:2 Changed 10 years ago by indomitable

I can't use just checked because If I have other kinds of inputs like type="checkbox" it won't work as I want.

Note: See TracTickets for help on using tickets.