jQuery.each()
Variations on jQuery.each()
by b9chris
HTML
<button>Run</button>
<div id=output></div>
CSS
body {
font-family: Verdana;
}
button {
display: block;
}
JavaScript
$('button').click(function() {
// Demo code
var obj = {
a: 'hi',
b: 'bye',
c: 'hello?'
};
$.each(obj, function(p) {
say(p + ': ' + this);
});
});
function say(s) {
var output = $('#output');
output.html(output.html() + s + '<br/>');
}