How to get an Array with jQuery, multiple <input> with the same name

前端 未结 9 667
既然无缘
既然无缘 2020-11-28 19:02

I have a form where users can add input fields with jQuery.


After submitting the

9条回答
  •  隐瞒了意图╮
    2020-11-28 19:18

    HTML:

    
    

    JS:

    var tasks= new Array();
    $('input[name^="task"]').each(function() 
    {
    tasks.push($(this).val());
    });
    

提交回复
热议问题