// Select the parent element const parent = document.getElementById('parentElementId'); // While the parent has child nodes, remove the first one while (parent.firstChild) { parent.removeChild(parent.firstChild); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter