我有这样的表格:
<form>
<select name="user_id[]"></select>
<select name="user_id[]"></select>
<select name="user_id[]"></select>
<select name="user_id[]"></select>
<select name="tag_id[]"></select>
<select name="tag_id[]"></select>
<select name="stack_id[]"></select>
<!-- ... etc. -->
</form>
我想按名称获取一个由第一个多值元素组成的 jQuery 集合:
<form>
<select name="user_id[]"></select> <!-- this -->
<select name="user_id[]"></select>
<select name="user_id[]"></select>
<select name="user_id[]"></select>
<select name="tag_id[]"></select> <!-- this -->
<select name="tag_id[]"></select>
<select name="stack_id[]"></select> <!-- this -->
<!-- ... etc. -->
</form>
我已经开始了,$('[name$="[]"]')
但我从那里被困住了。是否有一个简单的选择器方法,或者我必须全部选择它们并过滤我想要的那些?