+ 1
Naming js nodes
when creating new nodes in JavaScript can you give an id or class name?
1 Resposta
+ 2
you mean DOM elements? yes, you can dynamically assign id and class names to them.
const el = document.createElement('div'); el.classList.add('class-name-here');
el.id = 'id-name-here'