10 lines
230 B
JavaScript
10 lines
230 B
JavaScript
Node.prototype.createChild = function(name, className) {
|
|
const el = document.createElement(name);
|
|
|
|
if(typeof className === 'string') {
|
|
el.classList.add(className);
|
|
}
|
|
|
|
this.appendChild(el);
|
|
return el;
|
|
}; |