I'd use classes instead
<input type="text" name="opt[0][]" class="text test" /><br />
<input type="text" name="opt[0][]" class="text test" /><br />
<input type="text" name="opt[0][]" class="text test" /><br />
<input type="text" name="opt[0][]" class="text test" /><br />
<input type="text" name="opt[1][]" class="text test" /><br />
<input type="text" name="opt[1][]" class="text test" /><br />
<input type="text" name="opt[2][]" class="text test" /><br />
<input type="text" name="opt[2][]" class="text test" /><br />
<script type="text/javascript">
//<![CDATA[
alert($$('input.test').length);
//]]>
</script>
The '$$' reference: http://www.prototypejs.org/api/utility/dollar-dollar
On Thu, Jul 23, 2009 at 6:50 PM, diegoturriaga<[email protected]> wrote:
>
> I have something like that:
>
> <tr>
> <td>PEPE</td>
> <td><input ... name="opt[0][]"><input ... name="opt[0][]"> ...
> <input ... name="opt[0][]"></td>
> <td><select ... name="selA[]">...</select></td>
> <td><select ... name="selB[]">...</select></td>
> </tr>
> <tr>
> <td>JUAN</td>
> <td><input ... name="opt[1][]"><input ... name="opt[1]
> []">...<input ... name="opt[1][]"></td>
> <td><select ... name="selA[]">...</select></td>
> <td><select ... name="selB[]">...</select></td>
> </tr>
> ...
> <tr>
> <td>TITO</td>
> <td><input ... name="opt[n-1][]"><input ... name="opt[n-1][]"> ...
> <input ... name="opt[n-1][]"></td>
> <td><select ... name="selA[]">...</select></td>
> <td><select ... name="selB[]">...</select></td>
> </tr>
>
> I want to get the array opt[x] using prototype but $('opt[x]') give me
> only the first instance.
>
> I need something like getElementsByName but using prototype :)
>
> Sorry for my english...
> >
>
--
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---