I am currently messing with the .each() function in jQuery and I am trying to count all div‘s with the the id of item and add them to a string.
The problem is, I get a callback error from my jQuery source, which I load from jquery.com’s website.
var items = "";
$('div.item').each(function(){
items += $('this').data('id');
});
The error, as seen on firebug;
callback is undefined
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
I suspect it’s not the each, it’s the .data. You probably want
i.e. using
thisas a variable not a quoted string.