I mean that if I have 10 checkboxes in the same group and they all have name = "ppp" and class="foo" then my array of form elements will have 10 items and I only want one. I want a unique array of names of these elements that have class="foo"
so in my wish, my array will have one thing in it: The string "ppp"
if html's checkbox element had a parent, then I could call that class="foo" and be on my way.
Bear Bibeault wrote:If they all have the same name, just grab the name of the first element in the wrapped set.
well, if I have two selects of this class="foo" and two sets of checkboxes with class = "foo", then there are four different names.
if I do var foos = $(.foo);
then I have an array of 12 elements (2 selects and 10 checkboxes)
As you said, I'd like to grab the first element of each checkbox group, but if I have two checkbox groups, I don't know how to get anything but an undifferentiated array of checkboxes plus a few selects
I've moved to just trying for getting an array of checkboxes
Checkbox groups have different names. You don't need to get all the ".foo"'s at once. If you have a copy of my book, you should read chapter 2 again to learn how to make more fine-grained selections. Remember you can also use a combination of complex selectors and the .filter() method to hone a wrapped set to whatever you want.
subject: getting a unique list of elements with jquery