Ah, a little more tricky.

Assuming:
<tr>
<td><input type="checkbox" name="groupName[]"/></td>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>

-SCRIPT-
var values = [];
$$('input:checked["type=checkbox"]["name=groupName[]"]').each(
  function(el){
    value.push(el.up().next(1).nodes[0]);
  }
);

i don't really know if Prototype provides a clean "Get the text
content of this element" method, since IE likes innerText and Firefox
(i think) doesn't. This sample just assumes that the first node of the
second cell with content is text (remember, index 0 when DOM
navigating, so next(1) moves two cells).
-joe t.



On Jan 11, 8:03 am, Hussein B <hubaghd...@gmail.com> wrote:
> Thanks, it works for me.
> I have one further question:
> As I said, there is a checkbox at the end of each row.
> Now I know how to now if the checkbox is checked or not.
> What I want to do is if the checkbox is checked, I want to get the
> value of the second cell in the table.
>
> ID | NAME | DATE | STATUS | CHECKBOX
>
> How to do this?
> Sorry but I'm a client side developer usually, but I have this task to
> done.
> Thanks again.
>
> On Jan 11, 1:38 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
> wrote:
>
> > I use something like this ..
> > var array=new Array();
> > $$('.myClassName').each(function(e){
>
> > if(($e).checked==true) {
> > array.push($(e).value);
>
> > }
> > });
>
> > where....
>
> > <input type="checkbox" class="myClassName" value="I am checked" />
>
> > HTH
>
> > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > ----- Original Message -----
> > From: "Hussein B" <hubaghd...@gmail.com>
> > To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
> > Sent: Monday, January 11, 2010 8:11 AM
> > Subject: [Proto-Scripty] Collecting checked checkboxes
>
> > > Hey,
> > > I have a checkbox in front of each row in my table.
> > > Upon clicking on submit button, I want to collect the checked boxes
> > > and send values via Ajax request.
> > > How to iterate over the checked boxes?
> > > Thanks for help and time.
>
> > --------------------------------------------------------------------------- 
> > -----
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Prototype & script.aculo.us" group.
> > > To post to this group, send email to
> > > prototype-scriptacul...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to