Recently I’m getting stuck on this. I have a set of text boxes that have the same name like this:
<p><input type="text" name="test[]" /></p>
<p><input type="text" name="test[]" /></p>
<p><input type="text" name="test[]" /></p>
So what I need to do is select the 2nd element of group. I tried to alert
$('input[name="test['2']"]').val(); but it doesn’t work.
Can anyone help me with this?
Thanks.
You may use eq :
or :eq :
Note that the index is zero-based in both cases