Reputation: 26771
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.
Upvotes: 0
Views: 365
Reputation: 27119
You can use the Attribute Ends With selector:
$("input[name$='[A]']")
Upvotes: 2