I have an array of DIV elements in an array called ‘noactiveMsg’.
I want to load these DIV elements into a DIV called $('#chatCenterMembers').
I’ve tried:
noactiveMsg.appendTo($('#chatCenterMembers'));
But this doesn’t work.
Can someone advice on the syntax to load an array of elements/objects into a div?
code to made the array:
var noactiveMsg=[];
$('div.chatmember').each(function() {
if($(this).children().children('div').hasClass('chatactivestatus_offline')) {
alert('offline');
noactiveMsg.push($(this));
}
});
If each element of your array is a jQuery object, you can try this:
Some sample html:
The jQuery stuff:
see it work on jsFiddle
I also answered a similar question just recently