I just had a wild idea and it looks like working replace following code in prettyCheckboxes $('input[name='+$toCheck.attr('name')+']').each(function(){ $('label[for=' + $(this).attr('id')+']').removeClass ('checked'); });
with $(document.getElementsByName($toCheck.attr('name'))).each(function(){ $('label[for=' + $(this).attr('id')+']').removeClass('checked'); }); I basically replace the $('input[name='+$toCheck.attr('name')+']') with $(document.getElementsByName($toCheck.attr('name'))) wich is the same thing. And it's working now.... But i do not know about compatibilities of getElementsByName Works in FF 3 and IE 7 not sure about all other safari .... George. On Nov 13, 6:12 pm, Ahhk <[EMAIL PROTECTED]> wrote: > Wow, ok...thanks! > > I didnt think it was a jQuery issue and am surprised that jQuery, with as > robust and fantastic as it is, wouldn't support array names for form > elements. > > That seems like a major oversight to me :/ > > But, maybe I'm one of only a few people who actually use array names/IDs. > hrmmmm. > > It's SO much easier processing the data that way (numerically) instead of > having to concatenate var names. > > > > > > George-147 wrote: > > > I am with you now.... > > the problem is that you have weird name, with '[]' in it. > > > this line > > $('input[name='+$toCheck.attr('name')+']') > > fails and returns empty collection. > > > The problem is described here > >http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_... > > > Unfortunatelly i failed to make it work with the solution there i am > > afraid that to many [] in the selector confusing JQuery. In their > > example they did it with the id so there were no additional [ ] > > brackets. > > $('input[name=q\\[1\\]]') returns me empty collection as well.. > > > but you might try to ask this group more specific question on how to > > make JQuery selectors work with the name like that q[1] > > > George. > > > Ahhk wrote: > >> Thanks, but I didnt say I didnt want them to have the same name, I said > >> that > >> the script didnt work when the names were arrays. > > >> When the radio button groups have an name with an array, the script > >> breaks > >> and you can select/deselect multiple radio buttons within the group. > > >> Here's an example: > > >> <label for="q1-1">1</label><input type="radio" name="q[1]" value="1" > >> id="q1-1" /> > >> <label for="q1-2">2</label><input type="radio" name="q[1]" value="2" > >> id="q1-2" /> > >> <label for="q1-3">3</label><input type="radio" name="q[1]" value="3" > >> id="q1-3" /> > >> <label for="q1-4">4</label><input type="radio" name="q[1]" value="4" > >> id="q1-4" /> > > >> <label for="q2-1">1</label><input type="radio" name="q[2]" value="1" > >> id="q2-1" /> > >> <label for="q2-2">2</label><input type="radio" name="q[2]" value="2" > >> id="q2-2" /> > >> <label for="q2-3">3</label><input type="radio" name="q[2]" value="3" > >> id="q2-3" /> > >> <label for="q2-4">4</label><input type="radio" name="q[2]" value="4" > >> id="q2-4" /> > > >> <label for="q3-1">1</label><input type="radio" name="q3" value="1" > >> id="q3-1" > >> /> > >> <label for="q3-2">2</label><input type="radio" name="q3" value="2" > >> id="q3-2" > >> /> > >> <label for="q3-3">3</label><input type="radio" name="q3" value="3" > >> id="q3-3" > >> /> > >> <label for="q3-4">4</label><input type="radio" name="q3" value="4" > >> id="q3-4" > >> /> > > >> <label for="q4-1">1</label><input type="radio" name="q4" value="1" > >> id="q4-1" > >> /> > >> <label for="q4-2">2</label><input type="radio" name="q4" value="2" > >> id="q4-2" > >> /> > >> <label for="q4-3">3</label><input type="radio" name="q4" value="3" > >> id="q4-3" > >> /> > >> <label for="q4-4">4</label><input type="radio" name="q4" value="4" > >> id="q4-4" > >> /> > > >> The first two groups DONT work right, but the last two groups DO work. > > >> array name: q[4] vs non-array name: q4 > > >> With the first two groups, I can select all or some of the radio buttons > >> in > >> the group. This appears to be purely a cosmetic/UI issue since only the > >> value of the last one selected in the group gets submitted in the post > >> (as > >> it should). > > >> Something in the script doesnt support the array names. > > >> George-147 wrote: > > >> > Sorry instead of "Why do you want to give them the same name?" > > >> > I meant to say "Why do you not want to give them the same name?" > > >> > George. > > >> > On Nov 13, 3:06 pm, George <[EMAIL PROTECTED]> wrote: > >> >> The problem that regular radio buttons are working only when they have > >> >> the same name. > >> >> No wonder prettty ones not working too... :) > > >> >> Why do you want to give them the same name? > >> >> You can use different ids if you want. Something like this > > >> >> <input type="rario" name="group1" id="group1_1"> > >> >> <input type="rario" name="group1" id="group1_2"> > >> >> <input type="rario" name="group1" id="group1_3"> > > >> >> George. > > >> >> On Nov 12, 2:05 pm, Ahhk <[EMAIL PROTECTED]> wrote: > > >> >> > Anyone know how to fix this? > > >> >> > -- > >> >> > View this message in > > >> context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n... > >> >> > Sent from the jQuery General Discussion mailing list archive at > >> >> Nabble.com.- Hide quoted text - > > >> >> - Show quoted text - > > >> -- > >> View this message in context: > >>http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n... > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > > -- > View this message in > context:http://www.nabble.com/PrettyCheckboxes-not-working-with-radio-array-n... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.- > Hide quoted text - > > - Show quoted text -