While iterating over an object i get the error, Object.each is not a function, Here's my code:
$("#print").click(function() {
$values = {};
$("[data-type=text]").each(function(i,e){
if($(e).val() !='') {
$values[$(e).attr('name')] = $(e).val();
}
});
console.log($values);
$values.each(function(i,e){
console.log(i.e);
});
});
moreover, i can't use for loop too, since i don't know the keys .
$valuesis an object, why not useObject.values( $values ).forEach( /*...*/ )orObject.keys( $values ).forEach( /*...*/ )forEach!!!forEachSolved the issue.