Reputation: 97
I want to delete everything from the container w2
.
Then, place new data in w2
.
my code:
document.getElementById('w2').innerHTML = '';
db.collection('arraylist').where('id','==',activeID).get().then(snapshot => {
snapshot.docs.forEach(doc => {
var subgroups = doc.get('groups');
console.log(subgroups);
var j = 0;
for(j;j < subgroups.length;j++){
var sgroupName = subgroups[j];
var sframe = document.getElementById('subgroupsframe');
var sgroupholder = document.createElement('div');
sframe.appendChild(sgroupholder);
.... unnecessary code below
My code just leaves w2
blank instead of removing the data, then adding it. It should display sgroupholder
(which does have content, just not in this snippet.
How do I fix this?
Upvotes: 0
Views: 45
Reputation: 6180
You created sgroupholder
, but did not append it to any element. All you have to do is append sgroupholder
to sframe
.
sframe.appendChild(sgroupholder);
Upvotes: 1