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/
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Need-help-with-filter%2C-please.-tf3404215.html#a9481491
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to