I have string. I then split the string to make an array.
I use .each() to hopefully iterate through the array one by one and produce a certain output.
However, when I try to do this, I only get the value in the array outputted.
How comes?
I have set up a jsfiddle to demonstate what I have tried so far and the result I am getting:
var string = 'this is a string';
stringArray = string.split('');
$.each(stringArray, function(index, value){
$('#output').text(index + ' : ' + value);
});
I am trying to achieve it where user inputs text, clicks submit and it returns there input to them, but every time they click submit it replaces the current output.
see here http://jsfiddle.net/S7Z6K/4/ or http://jsfiddle.net/S7Z6K/6/
You are overwriting the old result set with
.textIn the code you can see I am appending old result set to new one’s hence everything appears fine.
hope this helps!
code