javascript - How to remove the last node of a node array? -


i have dom like

span span p p(to removed) p(to removed) 

and everytime event triggered, d remove last 2 p elements , append 2 more.

there node.removechild method, tried, turned out array of p not father element of p, not know whether did whole wrong way.

so, how remove last 2 p nodes in array of p, clean space , append 2 more?

you want

el.parentnode.removechild(el); 

the parentnode property allow use removechild in way intended to.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -