I am creating an array of text values from a group of dynamically generated textareas.
I put an alert statement in the loop to see if it was working, and it's only alerting the first textarea that it encounters but none of the rest.
Here is my jQuery:
var textArray = [];
$('[name=txtObjective]').each(function (i) {
alert($(this).val());
textArray.push(i.val());
});
And here is what my textareas look like:
<textarea name='txtObjective' class='objectives'>this is some text</textarea>
<textarea name='txtObjective' class='objectives'>this is some more text</textarea>
<textarea name='txtObjective' class='objectives'>this is even some more text</textarea>
Any clue what I'm doing wrong?
Thanks