I'm having problems with assigning to a variable within an each in jQuery.
(function(){
var filters = $(".filter_check:checked");
var hiddenFields = '';
$.each(filters, function(){
hiddenFields += "&" + $(this).data('param') + "=1";
});
console.log( hiddenFields );
})();
On the last line, when I check the output, I see that the variable is exactly as declared above, an empty string. The assignment / concatenation in .each did not work ... This seems to me to be a problem with scope. Could anyone tell me what I'm doing wrong?