Hi I've tried to write JavaScript (jQuery) function to merge values from input type text.
My code
$('#addpoll').click(function () {
var answers = $('#answertable').find('input[type=text]');
var answersStream = '';
$.each(answers, function(index, value) {
answersStream=answersStream.val()+value+'#';
});
alert(answersStream);
});
So there is html code
<table id="answertable">
<tr><td>1]</td><td><input type="text" name="answer1" id="answer1" style="width:300px" /></td></tr>
<tr><td>2]</td><td><input type="text" name="answer2" id="answer2" style="width:300px" /></td></tr>
</table>
Answers are added by jQuery dynamically, so there could by N answers
I want output in variable answersStream like: yes#no#undefine
But function each doesn't work like that. Function goes through objects but it cant't receive values.