Is it possible to run a jQuery .each statement a certain amount of times rather then for each of the items being iterated? The JSON being iterated is a last.fm feed, and of course, they ignore the "limit" request often. I would like to bypass this error by only running the .each statement so many times.
var limit = 5;
$("somelement").each(function(i, val) {
if(i > limit) return false;
// do stuff
});
or
$("somelement:lt(5)").each(function() {
// do stuff
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With