The IDs are differnent. That selector I'm using says find me a radio button that has an attribute "id" which *ends with* in this case a number. The IDs themselves are like this:

<input id="UniqueRadio_1".../>
<input id="OtherUniqueRadio_1.../>

The important thing to me is to get the radio buttons that have the right ID 'index' for lack of a better term. I've got a select box named (cleverly) "select_1". All IDs with an "_1" belong to select_1. See?

Chris

ps. still haven't tried your suggestion. Just saw this post and thought I'd respond real quick. :o)


Daemach wrote:
Hmm - that does bring up a point tho...  aren't ID's supposed to be unique
even in checkboxes?  May need to use the name attribute instead...



Daemach wrote:
I usually use filter with a selector, but a function should work.  Can you
not do the following instead tho?

$("radio:[EMAIL PROTECTED]" + id + "]")



Christopher Jordan wrote:
Hi folks,

I've tried to use the filter function in the past, but have never been successful. Usually, I just figure out another better way to do what I wanted (meaning that filter was probably the wrong choice to begin with), but now I've got a case where I think filter would work fine, but I'm still struggling with a couple of things.

1. do I need to use filter(expression) or filter(filter)?

2. what should my expression or filter look like?

Okay, so here's the situation I find myself in:

I've got a page with several select boxes and there are two radio buttons associated with each one. I need to gather all the select boxes and then for each one I want to select the associated radio button which is checked. I could just get both of the associated radio buttons, but I figure that a filter should be able to weed out the ones that are not checked. Right?

Here's what I've got so far:

$("select").each(function(){
    var $thisElement = $(this)[0];
    var id = $.ListLast($thisElement, "_");
// for each select element get the corresponding checked sortdirection radio button
    $("[EMAIL PROTECTED]" + id + "]").filter(function(){
        // I'm just not sure what to put here... maybe something like:
        $(this).attr("checked");
    });
});

As you can see I'm leaning toward the idea that I think I need a filter(filter) instead of a filter(expression). I'm just not sure what my filter or expression should be or even which one is indeed right.

I would appreciate any help I could get.

Thanks,
Chris

--
http://www.cjordan.us


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
http://www.cjordan.us

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to