in Programming by (9.4k points)
0 like 0 dislike

How I can to create HTML element on pure JavaScript?

js create html element

1 Answer

0 like 0 dislike
by (9.4k points)

Like this:

var el = document.createElement('p');
var elTxt = document.createTextNode('foo');
var parent = document.getElementById('parentEl');
parent.insertAdjacentElement('afterend', el);

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.