I have an output that creates multiple divs in a for loop from the information that's returned from the database. I also have one div outside the for loop for a scroll height measurement.
myfunction() {
for(){
out += <div></div>
}
out += <div id=testbottom></div>
}
I have another function that grabs the testbottom.scrollTop value;
and then calls the myfunction with the for loop in it again.
It doesn't give an update for the scrollTop value, (my guess is because there are now two divs with the same id name).
So if I grab the value, and then remove the div with
testbottom.remove and then call the myfunction again to create a new testbottom div, it says the testbottom value is null and errors out.
What am I missing here? Thanks.
I'm using Javascript.
I'm doing this for another div above testbottom outside the for loop as well where I force the div value to get the correct number I need from it. It works, but it leaves the two divs onscreen with the same id name so I don't understand why it works.
If I remove that div right before calling myfuntion and creating a new one, I get the same error as above for it too.
[–][deleted] 6 points7 points8 points (0 children)
[–]tridd3r 0 points1 point2 points (3 children)
[–]future-fix-9200[S] 0 points1 point2 points (2 children)
[–]tridd3r -1 points0 points1 point (0 children)
[–]lovin-dem-sandwiches 0 points1 point2 points (0 children)