Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Element.prototype.removeChildren = () => {
- while(this.firstChild) {
- this.removeChild(this.firstChild);
- }
- }
- // the main problem of this script is not working prototype method 'removeChildren';
- // but all without a method works perfectly!
- var footer = document.querySelector('#footer');
- footer.removeChildren();
- // it doesn't work unfortunately!
- for (var i = 0; i < footer.childElementCount; i++) {
- footer.removeChild(footer.firstChild);
- }
- // it works without problems!
Add Comment
Please, Sign In to add comment