I have a dom now which is like
span
span
p
p(to be removed)
p(to be removed)
and everytime a event was triggered, I d like to remove the last two p elements and append 2 more.
There is a node.removeChild method, but I tried, which turned out that the array of p is not the father element of p, but I do not know whether I did it the whole wrong way.
So, how could I remove the last two p nodes in the array of p, so I could clean the space and append two more?