I am creating a jQuery array but my code keeps returning [object Object], 3 times.
Here is my code:
var idArray = [];
$('.taskPHP').each(function() {
var idStr = {
'taskPHPid': $(this).attr('id'),
'taskValue': $(this).val()
}
idArray.push(idStr);
});
alert(idArray);
EDIT:
Just call me stupid…i knew i couldn’t alert an array. err…to many beers and programming don’t mix.
I will give u credit as soon as I can. Thanks for the help.
Seems fine, try
console.logand see what it outputs, oralert(JSON.stringify(idArray))