How do I get values of input element with the same name as an javascript array?

后端 未结 3 1365
孤独总比滥情好
孤独总比滥情好 2020-12-16 05:51

I want to get values of the input element that those elements are under the same name, name=\"items[]\"
for example:

...
3条回答
  •  执笔经年
    2020-12-16 06:31

    var values = [];
    $("input[name='items[]']").each(function() {
        values.push($(this).val());
    });
    

提交回复
热议问题