Doh! I just found an example on the first page of the selectors
documentation. Duh... I read that doc, but not the stuff toward the top.
Here's the exact example:
All checked radio buttons:
$("[EMAIL PROTECTED]@checked]")
Man... I feel stupid. Oh well. Thanks for tryin' to help me there
Daemach. :o)
Cheers,
Chris
Daemach wrote:
I understand, but in your radio selector you're using [EMAIL PROTECTED] which
means
"begins with an underscore" In this case I think you want [EMAIL PROTECTED]
which
means "contains an underscore".
Another option might be $(this).siblings(":radio:checked") (UNTESTED!), this
being the select and with the caveat that each select/radio set should be
descendants of another tag such as a div or td to avoid grabbing all of the
radio buttons...
Christopher Jordan wrote:
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/
--
http://www.cjordan.us
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/