DEV Community

HandsomeTan
HandsomeTan

Posted on

How to insert elments using Javascript

Element.append() or Element.apeendChild(). append is different from appendChild: it can pass not onlyNode object but also strings.
we can use innerHTML attribute to insert strings containing elements into current Node object: Element.innertHTML = '<div></div>'

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay