views:

68

answers:

1

I have

<textarea name="a[]" id="a[]"></textarea>
<textarea name="a[]" id="a[]"></textarea>
<textarea name="a[]" id="a[]"></textarea>
<textarea name="a[]" id="a[]"></textarea>

and I want to get value of each textarea to array. How I do it?

+4  A: 
var values = [];
$("textarea[name=a[]]").each(function(){
    var text = $(this).val();
    values.push(text);
});
Diadistis