Yeah, that's great stuff.
Not sure it makes a difference, but jQuery has a :radio pseudo-class,
so instead of $('[EMAIL PROTECTED]') you could do $('input:radio')
Andy, you wrote:
We need to have more details on how to do things like this.
I've written a couple articles on DOM traversal here:
http://www.learningjquery.com/2006/11/how-to-get-anything-you-want-
part-1
http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-
part-2
but I'd be happy to write another one if there is something in
particular you'd like to see. I'm still a little pressed for time at
the moment, but we're getting close to finishing the book, so that
will free me up to pay a little more attentionto my sadly neglected
blog.
Cheers,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On May 25, 2007, at 5:19 PM, Andy Matthews wrote:
Damn...that's fantastic. We need to have more details on how to do
things like this. The code I might have come up with for that would
have been like 5 or 6 lines long at LEAST!
From: jquery-en@googlegroups.com [mailto:jquery-
[EMAIL PROTECTED] On Behalf Of Jake McGraw
Sent: Friday, May 25, 2007 4:03 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Getting column value for a selected table row?
Maybe, within click or change:
$("[EMAIL PROTECTED]").change(function(){
$(this).parent().siblings("td:eq(3)"). /* do something */;
});
So you document should look like:
<tr>
<td><input type="radio" name="mybutton"/></td>
<td></td>
<td></td>
<td><!-- This is your target --></td>
<td></td>
...
</tr>
The chain order:
$(this) --> the radio button
.parent() --> The td element wrapped around radio button
.siblings("td:eq(3)") --> All td element siblings, get the fourth
Haven't tested, hope it works for you.
- jake
On 5/25/07, Brad Perkins <[EMAIL PROTECTED] > wrote:
Given a table where the the first column of each row contains a radio
button.
Is there some jQuery selector magic that would allow me to get the
value of the cell in the 4th column when the radio button is selected?