jQuery.each()
Variations on jQuery.each()
by b9chris
HTML
<button>Run</button>
<div id=output></div>
CSS
body {
font-family: Verdana;
}
JavaScript
$('button').click(function() {
// Demo code
var array = ['hi', 'bye', 'hello?'];
$.each(array, function(i, val) {
say(i + ': ' + val);
});
});
function say(s) {
var output = $('#output');
output.html(output.html() + s + '<br/>');
}