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

Using map:

var values = $("input[id='task']")
              .map(function(){return $(this).val();}).get();

If you change or remove the id (which should be unique), you may also use the selector $("input[name="task\\[\\]"]")

Working example: http://jsbin.com/ixeze3

Leave a Comment