Skip to main content Accessibility Feedback

DOM Injection

document.createElement()

Create an element. Pass in the element to create, without angled brackets (<>), as an argument

let div = document.createElement('div');
let link = document.createElement('a');
let article = document.createElement('article');

Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.


Find this useful? You can support my work by purchasing an annual membership.