Ooo! If that works (which it probably will), then it'll be just another time that I've thought I could/should use filter, but have found a different or better way of doing what I was after. :o)

Thanks, Daemach! I'll try that straight way!

Cheers,
Chris

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
[email protected]
http://jquery.com/discuss/




--
http://www.cjordan.us

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to