views:

24

answers:

1

On my form, I store inputs in this way:

<input name="tokens[0][A]">
<input name="tokens[1][B]">
<input name="tokens[2][A]">

etc.

Is there a way, using javascript or jquery, to easily grab all the inputs with [A] as their final index? All I actually need to do is count the number of inputs with an [A] index.

+1  A: 

You can use the Attribute Ends With selector:

$("input[name$='[A]']")
klez
hey, thanks a lot. works like a charm
babonk